<!-- HTML header for doxygen 1.8.3.1-->
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.3.1"/>
<title>Sifteo SDK: math.h Source File</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/search.js"></script>
<script type="text/javascript">
  $(document).ready(function() { searchBox.OnSelectItem(0); });
</script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
<link href="doxygen-style-overrides.css" rel="stylesheet" type="text/css"/>
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<center>
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  <td id="projectlogo"><img alt="Sifteo SDK" src="sdk_logo.png"/></td>
  <td style="padding-left: 0.5em;">
   <div id="projectname">
   &#160;<span id="projectnumber">v1.0.0</span>
   </div>
  </td>
 </tr>
 </tbody>
</table>
</div>
</center>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.3.1 -->
<script type="text/javascript">
var searchBox = new SearchBox("searchBox", "search",false,'Search');
</script>
  <div id="navrow1" class="tabs">
    <ul class="tablist">
      <li><a href="index.html"><span>Home</span></a></li>
      <li><a href="pages.html"><span>Guides</span></a></li>
      <li><a href="modules.html"><span>Modules</span></a></li>
      <li><a href="annotated.html"><span>Reference</span></a></li>
      <li>
        <div id="MSearchBox" class="MSearchBoxInactive">
        <span class="left">
          <img id="MSearchSelect" src="search/mag_sel.png"
               onmouseover="return searchBox.OnSearchSelectShow()"
               onmouseout="return searchBox.OnSearchSelectHide()"
               alt=""/>
          <input type="text" id="MSearchField" value="Search" accesskey="S"
               onfocus="searchBox.OnSearchFieldFocus(true)" 
               onblur="searchBox.OnSearchFieldFocus(false)" 
               onkeyup="searchBox.OnSearchFieldChange(event)"/>
          </span><span class="right">
            <a id="MSearchClose" href="javascript:searchBox.CloseResultsWindow()"><img id="MSearchCloseImg" border="0" src="search/close.png" alt=""/></a>
          </span>
        </div>
      </li>
    </ul>
  </div>
  <div id="navrow2" class="tabs2">
    <ul class="tablist">
      <li><a href="files.html"><span>File&#160;List</span></a></li>
    </ul>
  </div>
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
<a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(0)"><span class="SelectionMark">&#160;</span>All</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(1)"><span class="SelectionMark">&#160;</span>Classes</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(2)"><span class="SelectionMark">&#160;</span>Namespaces</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(3)"><span class="SelectionMark">&#160;</span>Functions</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(4)"><span class="SelectionMark">&#160;</span>Variables</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(5)"><span class="SelectionMark">&#160;</span>Typedefs</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(6)"><span class="SelectionMark">&#160;</span>Enumerations</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(7)"><span class="SelectionMark">&#160;</span>Enumerator</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(8)"><span class="SelectionMark">&#160;</span>Groups</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(9)"><span class="SelectionMark">&#160;</span>Pages</a></div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>

<div id="nav-path" class="navpath">
  <ul>
<li class="navelem"><a class="el" href="dir_12cda917fe1d7c8b4e7d2501bb3636e4.html">sdk</a></li><li class="navelem"><a class="el" href="dir_2f23e30b638d6a5f333babd9a5d183e1.html">include</a></li><li class="navelem"><a class="el" href="dir_d5ace589187da7c83c1a7507ec9fbbef.html">sifteo</a></li>  </ul>
</div>
</div><!-- top -->
<div class="header">
  <div class="headertitle">
<div class="title">math.h</div>  </div>
</div><!--header-->
<div class="contents">
<div class="fragment"><div class="line"><a name="l00001"></a><span class="lineno">    1</span>&#160;<span class="comment">/* -*- mode: C; c-basic-offset: 4; intent-tabs-mode: nil -*-</span></div>
<div class="line"><a name="l00002"></a><span class="lineno">    2</span>&#160;<span class="comment"> *</span></div>
<div class="line"><a name="l00003"></a><span class="lineno">    3</span>&#160;<span class="comment"> * This file is part of the public interface to the Sifteo SDK.</span></div>
<div class="line"><a name="l00004"></a><span class="lineno">    4</span>&#160;<span class="comment"> * Copyright &lt;c&gt; 2012 Sifteo, Inc. All rights reserved.</span></div>
<div class="line"><a name="l00005"></a><span class="lineno">    5</span>&#160;<span class="comment"> */</span></div>
<div class="line"><a name="l00006"></a><span class="lineno">    6</span>&#160;</div>
<div class="line"><a name="l00007"></a><span class="lineno">    7</span>&#160;<span class="preprocessor">#pragma once</span></div>
<div class="line"><a name="l00008"></a><span class="lineno">    8</span>&#160;<span class="preprocessor"></span><span class="preprocessor">#ifdef NOT_USERSPACE</span></div>
<div class="line"><a name="l00009"></a><span class="lineno">    9</span>&#160;<span class="preprocessor"></span><span class="preprocessor">#   error This is a userspace-only header, not allowed by the current build.</span></div>
<div class="line"><a name="l00010"></a><span class="lineno">   10</span>&#160;<span class="preprocessor"></span><span class="preprocessor">#endif</span></div>
<div class="line"><a name="l00011"></a><span class="lineno">   11</span>&#160;<span class="preprocessor"></span></div>
<div class="line"><a name="l00012"></a><span class="lineno">   12</span>&#160;<span class="preprocessor">#include &lt;sifteo/abi.h&gt;</span></div>
<div class="line"><a name="l00013"></a><span class="lineno">   13</span>&#160;<span class="preprocessor">#include &lt;sifteo/macros.h&gt;</span></div>
<div class="line"><a name="l00014"></a><span class="lineno">   14</span>&#160;</div>
<div class="line"><a name="l00015"></a><span class="lineno">   15</span>&#160;<span class="keyword">namespace </span>Sifteo {</div>
<div class="line"><a name="l00016"></a><span class="lineno">   16</span>&#160;</div>
<div class="line"><a name="l00025"></a><span class="lineno">   25</span>&#160;<span class="comment">/*</span></div>
<div class="line"><a name="l00026"></a><span class="lineno">   26</span>&#160;<span class="comment"> * Common mathematical constants</span></div>
<div class="line"><a name="l00027"></a><span class="lineno">   27</span>&#160;<span class="comment"> */</span></div>
<div class="line"><a name="l00028"></a><span class="lineno">   28</span>&#160; </div>
<div class="line"><a name="l00029"></a><span class="lineno"><a class="code" href="group__math.html#ga9bf5d952c5c93c70f9e66c9794d406c9">   29</a></span>&#160;<span class="preprocessor">#define M_E         2.71828182845904523536028747135266250   </span></div>
<div class="line"><a name="l00030"></a><span class="lineno"><a class="code" href="group__math.html#gac5c747ee5bcbe892875672a0b9d8171c">   30</a></span>&#160;<span class="preprocessor">#define M_LOG2E     1.44269504088896340735992468100189214   </span></div>
<div class="line"><a name="l00031"></a><span class="lineno"><a class="code" href="group__math.html#ga9ed2b5582226f3896424ff6d2a3ebb14">   31</a></span>&#160;<span class="preprocessor">#define M_LOG10E    0.434294481903251827651128918916605082  </span></div>
<div class="line"><a name="l00032"></a><span class="lineno"><a class="code" href="group__math.html#ga92428112a5d24721208748774a4f23e6">   32</a></span>&#160;<span class="preprocessor">#define M_LN2       0.693147180559945309417232121458176568  </span></div>
<div class="line"><a name="l00033"></a><span class="lineno"><a class="code" href="group__math.html#ga0a53871497a155afe91424c28a8ec3c4">   33</a></span>&#160;<span class="preprocessor">#define M_LN10      2.30258509299404568401799145468436421   </span></div>
<div class="line"><a name="l00034"></a><span class="lineno"><a class="code" href="group__math.html#gae71449b1cc6e6250b91f539153a7a0d3">   34</a></span>&#160;<span class="preprocessor">#define M_PI        3.14159265358979323846264338327950288   </span></div>
<div class="line"><a name="l00035"></a><span class="lineno"><a class="code" href="group__math.html#gae0f7f25bda391b76da8251153e463a17">   35</a></span>&#160;<span class="preprocessor">#define M_TAU       6.2831853071795862                      </span></div>
<div class="line"><a name="l00036"></a><span class="lineno"><a class="code" href="group__math.html#ga958e4508ed28ee5cc04249144312c15f">   36</a></span>&#160;<span class="preprocessor">#define M_PI_2      1.57079632679489661923132169163975144   </span></div>
<div class="line"><a name="l00037"></a><span class="lineno"><a class="code" href="group__math.html#gaeb24420b096a677f3a2dc5a72b36bf22">   37</a></span>&#160;<span class="preprocessor">#define M_PI_4      0.785398163397448309615660845819875721  </span></div>
<div class="line"><a name="l00038"></a><span class="lineno"><a class="code" href="group__math.html#ga08dfac3cca9601a02fc88356cc078e1d">   38</a></span>&#160;<span class="preprocessor">#define M_1_PI      0.318309886183790671537767526745028724  </span></div>
<div class="line"><a name="l00039"></a><span class="lineno"><a class="code" href="group__math.html#ga97f6d6514d3d3dd50c3a2a6d622673db">   39</a></span>&#160;<span class="preprocessor">#define M_2_PI      0.636619772367581343075535053490057448  </span></div>
<div class="line"><a name="l00040"></a><span class="lineno"><a class="code" href="group__math.html#ga631ff334c4a1a6db2e8a7ff4acbe48a5">   40</a></span>&#160;<span class="preprocessor">#define M_2_SQRTPI  1.12837916709551257389615890312154517   </span></div>
<div class="line"><a name="l00041"></a><span class="lineno"><a class="code" href="group__math.html#ga66b3ab30f1332874326ed93969e496e0">   41</a></span>&#160;<span class="preprocessor">#define M_SQRT2     1.41421356237309504880168872420969808   </span></div>
<div class="line"><a name="l00042"></a><span class="lineno"><a class="code" href="group__math.html#gacdbb2c2f9429f08916f03c8786d2d2d7">   42</a></span>&#160;<span class="preprocessor">#define M_SQRT1_2   0.707106781186547524400844362104849039  </span></div>
<div class="line"><a name="l00043"></a><span class="lineno"><a class="code" href="group__math.html#ga5e9e29217f6ec61105a4520ec5942225">   43</a></span>&#160;<span class="preprocessor">#define MAXFLOAT    ((float)3.40282346638528860e+38)        </span></div>
<div class="line"><a name="l00044"></a><span class="lineno"><a class="code" href="group__math.html#ga8abfcc76130f3f991d124dd22d7e69bc">   44</a></span>&#160;<span class="preprocessor">#define NAN         __builtin_nanf(&quot;0x7fc00000&quot;)            </span></div>
<div class="line"><a name="l00045"></a><span class="lineno">   45</span>&#160;<span class="preprocessor"></span></div>
<div class="line"><a name="l00046"></a><span class="lineno">   46</span>&#160;<span class="preprocessor"></span></div>
<div class="line"><a name="l00053"></a><span class="lineno"><a class="code" href="group__math.html#ga7d41be453074674182cb7d1d7c759d91">   53</a></span>&#160;<span class="keyword">template</span> &lt;<span class="keyword">typename</span> T&gt; <span class="keyword">inline</span> T <a class="code" href="group__math.html#ga7d41be453074674182cb7d1d7c759d91" title="For any type, clamp a value to the extremes &#39;low&#39; and &#39;high&#39;.">clamp</a>(<span class="keyword">const</span> T&amp; value, <span class="keyword">const</span> T&amp; low, <span class="keyword">const</span> T&amp; high)</div>
<div class="line"><a name="l00054"></a><span class="lineno">   54</span>&#160;{</div>
<div class="line"><a name="l00055"></a><span class="lineno">   55</span>&#160;    <span class="keywordflow">if</span> (value &lt; low) {</div>
<div class="line"><a name="l00056"></a><span class="lineno">   56</span>&#160;        <span class="keywordflow">return</span> low;</div>
<div class="line"><a name="l00057"></a><span class="lineno">   57</span>&#160;    }</div>
<div class="line"><a name="l00058"></a><span class="lineno">   58</span>&#160;    <span class="keywordflow">if</span> (value &gt; high) {</div>
<div class="line"><a name="l00059"></a><span class="lineno">   59</span>&#160;        <span class="keywordflow">return</span> high;</div>
<div class="line"><a name="l00060"></a><span class="lineno">   60</span>&#160;    }</div>
<div class="line"><a name="l00061"></a><span class="lineno">   61</span>&#160;    <span class="keywordflow">return</span> value;</div>
<div class="line"><a name="l00062"></a><span class="lineno">   62</span>&#160;}</div>
<div class="line"><a name="l00063"></a><span class="lineno">   63</span>&#160;</div>
<div class="line"><a name="l00071"></a><span class="lineno"><a class="code" href="group__math.html#gadfdd37c09079cfe60965b09b186a24f0">   71</a></span>&#160;<span class="keyword">template</span> &lt;<span class="keyword">typename</span> T&gt; <span class="keyword">inline</span> T <a class="code" href="group__math.html#gadfdd37c09079cfe60965b09b186a24f0" title="For any type, return the absolute value.">abs</a>(<span class="keyword">const</span> T&amp; value)</div>
<div class="line"><a name="l00072"></a><span class="lineno">   72</span>&#160;{</div>
<div class="line"><a name="l00073"></a><span class="lineno">   73</span>&#160;    <span class="keywordflow">if</span> (value &lt; 0) {</div>
<div class="line"><a name="l00074"></a><span class="lineno">   74</span>&#160;        <span class="keywordflow">return</span> -value;</div>
<div class="line"><a name="l00075"></a><span class="lineno">   75</span>&#160;    }</div>
<div class="line"><a name="l00076"></a><span class="lineno">   76</span>&#160;    <span class="keywordflow">return</span> value;</div>
<div class="line"><a name="l00077"></a><span class="lineno">   77</span>&#160;}</div>
<div class="line"><a name="l00078"></a><span class="lineno">   78</span>&#160;</div>
<div class="line"><a name="l00087"></a><span class="lineno"><a class="code" href="group__math.html#ga299e958ec0ad2b0c1e20e601671b90ad">   87</a></span>&#160;<span class="keyword">template</span> &lt;<span class="keyword">typename</span> T&gt; <span class="keyword">inline</span> T <a class="code" href="group__math.html#ga299e958ec0ad2b0c1e20e601671b90ad" title="Logical shift left with clamping.">lslc</a>(<span class="keyword">const</span> T&amp; value, <span class="keywordtype">int</span> bits)</div>
<div class="line"><a name="l00088"></a><span class="lineno">   88</span>&#160;{</div>
<div class="line"><a name="l00089"></a><span class="lineno">   89</span>&#160;    <span class="keywordflow">if</span> (bits &lt; 0)</div>
<div class="line"><a name="l00090"></a><span class="lineno">   90</span>&#160;        <span class="keywordflow">return</span> value;</div>
<div class="line"><a name="l00091"></a><span class="lineno">   91</span>&#160;    <span class="keywordflow">if</span> (bits &gt;= <span class="keyword">sizeof</span>(T) * 8)</div>
<div class="line"><a name="l00092"></a><span class="lineno">   92</span>&#160;        <span class="keywordflow">return</span> 0;</div>
<div class="line"><a name="l00093"></a><span class="lineno">   93</span>&#160;    <span class="keywordflow">return</span> value &lt;&lt; (unsigned)bits;</div>
<div class="line"><a name="l00094"></a><span class="lineno">   94</span>&#160;}</div>
<div class="line"><a name="l00095"></a><span class="lineno">   95</span>&#160;</div>
<div class="line"><a name="l00103"></a><span class="lineno"><a class="code" href="group__math.html#ga9929710b21fe1361fecb23da1421c6cb">  103</a></span>&#160;<span class="keyword">template</span> &lt;<span class="keyword">typename</span> T&gt; <span class="keyword">inline</span> T <a class="code" href="group__math.html#ga9929710b21fe1361fecb23da1421c6cb" title="Logical shift right with clamping.">lsrc</a>(<span class="keyword">const</span> T&amp; value, <span class="keywordtype">int</span> bits)</div>
<div class="line"><a name="l00104"></a><span class="lineno">  104</span>&#160;{</div>
<div class="line"><a name="l00105"></a><span class="lineno">  105</span>&#160;    <span class="keywordflow">if</span> (bits &lt; 0)</div>
<div class="line"><a name="l00106"></a><span class="lineno">  106</span>&#160;        <span class="keywordflow">return</span> value;</div>
<div class="line"><a name="l00107"></a><span class="lineno">  107</span>&#160;    <span class="keywordflow">if</span> (bits &gt;= <span class="keyword">sizeof</span>(T) * 8)</div>
<div class="line"><a name="l00108"></a><span class="lineno">  108</span>&#160;        <span class="keywordflow">return</span> 0;</div>
<div class="line"><a name="l00109"></a><span class="lineno">  109</span>&#160;    <span class="keywordflow">return</span> value &gt;&gt; (unsigned)bits;</div>
<div class="line"><a name="l00110"></a><span class="lineno">  110</span>&#160;}</div>
<div class="line"><a name="l00111"></a><span class="lineno">  111</span>&#160;</div>
<div class="line"><a name="l00120"></a><span class="lineno"><a class="code" href="group__math.html#gab99e4d068797e2f419e3c48a76af1144">  120</a></span>&#160;<span class="keyword">template</span> &lt;<span class="keyword">typename</span> T&gt; <span class="keyword">inline</span> T <a class="code" href="group__math.html#gab99e4d068797e2f419e3c48a76af1144" title="Return a value of type T which has bits set in the half-open interval [begin, end).">bitRange</a>(<span class="keywordtype">int</span> begin, <span class="keywordtype">int</span> end)</div>
<div class="line"><a name="l00121"></a><span class="lineno">  121</span>&#160;{</div>
<div class="line"><a name="l00122"></a><span class="lineno">  122</span>&#160;    <span class="keywordflow">return</span> <a class="code" href="group__math.html#ga299e958ec0ad2b0c1e20e601671b90ad" title="Logical shift left with clamping.">lslc</a>((T)-1, begin) &amp; ~<a class="code" href="group__math.html#ga299e958ec0ad2b0c1e20e601671b90ad" title="Logical shift left with clamping.">lslc</a>((T)-1, end);</div>
<div class="line"><a name="l00123"></a><span class="lineno">  123</span>&#160;}</div>
<div class="line"><a name="l00124"></a><span class="lineno">  124</span>&#160;</div>
<div class="line"><a name="l00135"></a><span class="lineno"><a class="code" href="group__math.html#ga4cf109c83c9cc94b55fe03126792c6bd">  135</a></span>&#160;<span class="keyword">inline</span> <span class="keywordtype">unsigned</span> <a class="code" href="group__math.html#ga4cf109c83c9cc94b55fe03126792c6bd" title="Count leading zeroes in a 32-bit word.">clz</a>(uint32_t word)</div>
<div class="line"><a name="l00136"></a><span class="lineno">  136</span>&#160;{</div>
<div class="line"><a name="l00137"></a><span class="lineno">  137</span>&#160;    <span class="keywordflow">return</span> __builtin_clz(word);</div>
<div class="line"><a name="l00138"></a><span class="lineno">  138</span>&#160;}</div>
<div class="line"><a name="l00139"></a><span class="lineno">  139</span>&#160;</div>
<div class="line"><a name="l00150"></a><span class="lineno"><a class="code" href="group__math.html#gae573cb5ba7e18079d9e661e486f994a6">  150</a></span>&#160;<span class="keyword">inline</span> <span class="keywordtype">unsigned</span> <a class="code" href="group__math.html#gae573cb5ba7e18079d9e661e486f994a6" title="Find first bit set in a 32-bit word.">ffs</a>(uint32_t word)</div>
<div class="line"><a name="l00151"></a><span class="lineno">  151</span>&#160;{</div>
<div class="line"><a name="l00152"></a><span class="lineno">  152</span>&#160;    <span class="comment">// Reference: http://en.wikipedia.org/wiki/Find_first_set#Properties_and_relations</span></div>
<div class="line"><a name="l00153"></a><span class="lineno">  153</span>&#160;    <span class="keywordflow">return</span> 32 - __builtin_clz(word &amp; -word);</div>
<div class="line"><a name="l00154"></a><span class="lineno">  154</span>&#160;}</div>
<div class="line"><a name="l00155"></a><span class="lineno">  155</span>&#160;</div>
<div class="line"><a name="l00157"></a><span class="lineno"><a class="code" href="group__math.html#ga3d9151f81e76f9c4e4f573e5ab6c892e">  157</a></span>&#160;<span class="keywordtype">float</span> <span class="keyword">inline</span> <a class="code" href="group__math.html#ga3d9151f81e76f9c4e4f573e5ab6c892e" title="Compute the remainder (modulo) operation for two floating point numbers. Single-precision.">fmod</a>(<span class="keywordtype">float</span> a, <span class="keywordtype">float</span> b)</div>
<div class="line"><a name="l00158"></a><span class="lineno">  158</span>&#160;{</div>
<div class="line"><a name="l00159"></a><span class="lineno">  159</span>&#160;    uint32_t r = _SYS_fmodf(reinterpret_cast&lt;uint32_t&amp;&gt;(a), reinterpret_cast&lt;uint32_t&amp;&gt;(b));</div>
<div class="line"><a name="l00160"></a><span class="lineno">  160</span>&#160;    <span class="keywordflow">return</span> <span class="keyword">reinterpret_cast&lt;</span><span class="keywordtype">float</span>&amp;<span class="keyword">&gt;</span>(r);</div>
<div class="line"><a name="l00161"></a><span class="lineno">  161</span>&#160;}</div>
<div class="line"><a name="l00162"></a><span class="lineno">  162</span>&#160;</div>
<div class="line"><a name="l00164"></a><span class="lineno"><a class="code" href="group__math.html#ga405aaa390bf918b4c2949a8467d6048d">  164</a></span>&#160;<span class="keywordtype">double</span> <span class="keyword">inline</span> <a class="code" href="group__math.html#ga3d9151f81e76f9c4e4f573e5ab6c892e" title="Compute the remainder (modulo) operation for two floating point numbers. Single-precision.">fmod</a>(<span class="keywordtype">double</span> a, <span class="keywordtype">double</span> b)</div>
<div class="line"><a name="l00165"></a><span class="lineno">  165</span>&#160;{</div>
<div class="line"><a name="l00166"></a><span class="lineno">  166</span>&#160;    uint64_t ia = <span class="keyword">reinterpret_cast&lt;</span>uint64_t&amp;<span class="keyword">&gt;</span>(a);</div>
<div class="line"><a name="l00167"></a><span class="lineno">  167</span>&#160;    uint64_t ib = <span class="keyword">reinterpret_cast&lt;</span>uint64_t&amp;<span class="keyword">&gt;</span>(b);</div>
<div class="line"><a name="l00168"></a><span class="lineno">  168</span>&#160;    uint64_t r = _SYS_fmod(ia, ia &gt;&gt; 32, ib, ib &gt;&gt; 32);</div>
<div class="line"><a name="l00169"></a><span class="lineno">  169</span>&#160;    <span class="keywordflow">return</span> <span class="keyword">reinterpret_cast&lt;</span><span class="keywordtype">double</span>&amp;<span class="keyword">&gt;</span>(r);</div>
<div class="line"><a name="l00170"></a><span class="lineno">  170</span>&#160;}</div>
<div class="line"><a name="l00171"></a><span class="lineno">  171</span>&#160;</div>
<div class="line"><a name="l00173"></a><span class="lineno"><a class="code" href="group__math.html#gae3446e8ce8d114dc81a814984c61431c">  173</a></span>&#160;<span class="keywordtype">float</span> <span class="keyword">inline</span> <a class="code" href="group__math.html#gae3446e8ce8d114dc81a814984c61431c" title="Compute &#39;x&#39; raised to the power &#39;y&#39;. Single-precision.">pow</a>(<span class="keywordtype">float</span> a, <span class="keywordtype">float</span> b)</div>
<div class="line"><a name="l00174"></a><span class="lineno">  174</span>&#160;{</div>
<div class="line"><a name="l00175"></a><span class="lineno">  175</span>&#160;    uint32_t r = _SYS_powf(reinterpret_cast&lt;uint32_t&amp;&gt;(a), reinterpret_cast&lt;uint32_t&amp;&gt;(b));</div>
<div class="line"><a name="l00176"></a><span class="lineno">  176</span>&#160;    <span class="keywordflow">return</span> <span class="keyword">reinterpret_cast&lt;</span><span class="keywordtype">float</span>&amp;<span class="keyword">&gt;</span>(r);</div>
<div class="line"><a name="l00177"></a><span class="lineno">  177</span>&#160;}</div>
<div class="line"><a name="l00178"></a><span class="lineno">  178</span>&#160;</div>
<div class="line"><a name="l00180"></a><span class="lineno"><a class="code" href="group__math.html#ga07a5ddecb26025a011adb4da5941fb10">  180</a></span>&#160;<span class="keywordtype">double</span> <span class="keyword">inline</span> <a class="code" href="group__math.html#gae3446e8ce8d114dc81a814984c61431c" title="Compute &#39;x&#39; raised to the power &#39;y&#39;. Single-precision.">pow</a>(<span class="keywordtype">double</span> a, <span class="keywordtype">double</span> b)</div>
<div class="line"><a name="l00181"></a><span class="lineno">  181</span>&#160;{</div>
<div class="line"><a name="l00182"></a><span class="lineno">  182</span>&#160;    uint64_t ia = <span class="keyword">reinterpret_cast&lt;</span>uint64_t&amp;<span class="keyword">&gt;</span>(a);</div>
<div class="line"><a name="l00183"></a><span class="lineno">  183</span>&#160;    uint64_t ib = <span class="keyword">reinterpret_cast&lt;</span>uint64_t&amp;<span class="keyword">&gt;</span>(b);</div>
<div class="line"><a name="l00184"></a><span class="lineno">  184</span>&#160;    uint64_t r = _SYS_pow(ia, ia &gt;&gt; 32, ib, ib &gt;&gt; 32);</div>
<div class="line"><a name="l00185"></a><span class="lineno">  185</span>&#160;    <span class="keywordflow">return</span> <span class="keyword">reinterpret_cast&lt;</span><span class="keywordtype">double</span>&amp;<span class="keyword">&gt;</span>(r);</div>
<div class="line"><a name="l00186"></a><span class="lineno">  186</span>&#160;}</div>
<div class="line"><a name="l00187"></a><span class="lineno">  187</span>&#160;</div>
<div class="line"><a name="l00189"></a><span class="lineno"><a class="code" href="group__math.html#gacd70c1d896652ae6cd08793202b929bf">  189</a></span>&#160;<span class="keywordtype">unsigned</span> <span class="keyword">inline</span> <a class="code" href="group__math.html#gacd70c1d896652ae6cd08793202b929bf" title="Compute the unsigned remainder from dividing two signed integers.">umod</a>(<span class="keywordtype">int</span> a, <span class="keywordtype">int</span> b)</div>
<div class="line"><a name="l00190"></a><span class="lineno">  190</span>&#160;{</div>
<div class="line"><a name="l00191"></a><span class="lineno">  191</span>&#160;    <span class="keywordtype">int</span> r = a % b;</div>
<div class="line"><a name="l00192"></a><span class="lineno">  192</span>&#160;    <span class="keywordflow">if</span> (r &lt; 0)</div>
<div class="line"><a name="l00193"></a><span class="lineno">  193</span>&#160;        r += b;</div>
<div class="line"><a name="l00194"></a><span class="lineno">  194</span>&#160;    <span class="keywordflow">return</span> r;</div>
<div class="line"><a name="l00195"></a><span class="lineno">  195</span>&#160;}</div>
<div class="line"><a name="l00196"></a><span class="lineno">  196</span>&#160;</div>
<div class="line"><a name="l00198"></a><span class="lineno"><a class="code" href="group__math.html#gaf797a19cdc5c3a124f146e6faf6cafe0">  198</a></span>&#160;<span class="keyword">template</span> &lt;<span class="keyword">typename</span> T&gt; <span class="keyword">inline</span> T <a class="code" href="group__math.html#gaf797a19cdc5c3a124f146e6faf6cafe0" title="Ceiling division. Divide, rounding up instead of down.">ceildiv</a>(T numerator, T denominator) {</div>
<div class="line"><a name="l00199"></a><span class="lineno">  199</span>&#160;    <span class="keywordflow">return</span> (numerator + (denominator - 1)) / denominator;</div>
<div class="line"><a name="l00200"></a><span class="lineno">  200</span>&#160;}</div>
<div class="line"><a name="l00201"></a><span class="lineno">  201</span>&#160;</div>
<div class="line"><a name="l00206"></a><span class="lineno"><a class="code" href="group__math.html#gad5ac250fc2b7c3f647ad5dd76f80a57e">  206</a></span>&#160;<span class="keyword">template</span> &lt;<span class="keyword">typename</span> T&gt; <span class="keyword">inline</span> T <a class="code" href="group__math.html#gad5ac250fc2b7c3f647ad5dd76f80a57e" title="Round &#39;numerator&#39; up to the nearest multiple of &#39;denominator&#39;. Only for integer types.">roundup</a>(T numerator, T denominator) {</div>
<div class="line"><a name="l00207"></a><span class="lineno">  207</span>&#160;    <span class="keywordflow">return</span> <a class="code" href="group__math.html#gaf797a19cdc5c3a124f146e6faf6cafe0" title="Ceiling division. Divide, rounding up instead of down.">ceildiv</a>(numerator, denominator) * denominator;</div>
<div class="line"><a name="l00208"></a><span class="lineno">  208</span>&#160;}</div>
<div class="line"><a name="l00209"></a><span class="lineno">  209</span>&#160;</div>
<div class="line"><a name="l00211"></a><span class="lineno"><a class="code" href="group__math.html#ga4c75549406b0cd0f1c3751641740f668">  211</a></span>&#160;<span class="keywordtype">float</span> <span class="keyword">inline</span> <a class="code" href="group__math.html#ga4c75549406b0cd0f1c3751641740f668" title="Compute the natural log of a floating point number. Single-precision.">log</a>(<span class="keywordtype">float</span> a)</div>
<div class="line"><a name="l00212"></a><span class="lineno">  212</span>&#160;{</div>
<div class="line"><a name="l00213"></a><span class="lineno">  213</span>&#160;    uint32_t r = _SYS_logf(reinterpret_cast&lt;uint32_t&amp;&gt;(a));</div>
<div class="line"><a name="l00214"></a><span class="lineno">  214</span>&#160;    <span class="keywordflow">return</span> <span class="keyword">reinterpret_cast&lt;</span><span class="keywordtype">float</span>&amp;<span class="keyword">&gt;</span>(r);</div>
<div class="line"><a name="l00215"></a><span class="lineno">  215</span>&#160;}</div>
<div class="line"><a name="l00216"></a><span class="lineno">  216</span>&#160;</div>
<div class="line"><a name="l00218"></a><span class="lineno"><a class="code" href="group__math.html#ga50e18529e91437b4bc8f94a37801a606">  218</a></span>&#160;<span class="keywordtype">double</span> <span class="keyword">inline</span> <a class="code" href="group__math.html#ga4c75549406b0cd0f1c3751641740f668" title="Compute the natural log of a floating point number. Single-precision.">log</a>(<span class="keywordtype">double</span> a)</div>
<div class="line"><a name="l00219"></a><span class="lineno">  219</span>&#160;{</div>
<div class="line"><a name="l00220"></a><span class="lineno">  220</span>&#160;    uint64_t ia = <span class="keyword">reinterpret_cast&lt;</span>uint64_t&amp;<span class="keyword">&gt;</span>(a);</div>
<div class="line"><a name="l00221"></a><span class="lineno">  221</span>&#160;    uint64_t r = _SYS_logd(ia, ia &gt;&gt; 32);</div>
<div class="line"><a name="l00222"></a><span class="lineno">  222</span>&#160;    <span class="keywordflow">return</span> <span class="keyword">reinterpret_cast&lt;</span><span class="keywordtype">double</span>&amp;<span class="keyword">&gt;</span>(r);</div>
<div class="line"><a name="l00223"></a><span class="lineno">  223</span>&#160;}</div>
<div class="line"><a name="l00224"></a><span class="lineno">  224</span>&#160;</div>
<div class="line"><a name="l00226"></a><span class="lineno"><a class="code" href="group__math.html#ga20311b4dc8c3af67579a2517c36e2e4e">  226</a></span>&#160;<span class="keywordtype">float</span> <span class="keyword">inline</span> <a class="code" href="group__math.html#ga20311b4dc8c3af67579a2517c36e2e4e" title="Compute the square root of a floating point number. Single-precision.">sqrt</a>(<span class="keywordtype">float</span> a)</div>
<div class="line"><a name="l00227"></a><span class="lineno">  227</span>&#160;{</div>
<div class="line"><a name="l00228"></a><span class="lineno">  228</span>&#160;    uint32_t r = _SYS_sqrtf(reinterpret_cast&lt;uint32_t&amp;&gt;(a));</div>
<div class="line"><a name="l00229"></a><span class="lineno">  229</span>&#160;    <span class="keywordflow">return</span> <span class="keyword">reinterpret_cast&lt;</span><span class="keywordtype">float</span>&amp;<span class="keyword">&gt;</span>(r);</div>
<div class="line"><a name="l00230"></a><span class="lineno">  230</span>&#160;}</div>
<div class="line"><a name="l00231"></a><span class="lineno">  231</span>&#160;</div>
<div class="line"><a name="l00233"></a><span class="lineno"><a class="code" href="group__math.html#ga28b7d0348f10505fb9b828371f895d32">  233</a></span>&#160;<span class="keywordtype">double</span> <span class="keyword">inline</span> <a class="code" href="group__math.html#ga20311b4dc8c3af67579a2517c36e2e4e" title="Compute the square root of a floating point number. Single-precision.">sqrt</a>(<span class="keywordtype">double</span> a)</div>
<div class="line"><a name="l00234"></a><span class="lineno">  234</span>&#160;{</div>
<div class="line"><a name="l00235"></a><span class="lineno">  235</span>&#160;    uint64_t ia = <span class="keyword">reinterpret_cast&lt;</span>uint64_t&amp;<span class="keyword">&gt;</span>(a);</div>
<div class="line"><a name="l00236"></a><span class="lineno">  236</span>&#160;    uint64_t r = _SYS_sqrt(ia, ia &gt;&gt; 32);</div>
<div class="line"><a name="l00237"></a><span class="lineno">  237</span>&#160;    <span class="keywordflow">return</span> <span class="keyword">reinterpret_cast&lt;</span><span class="keywordtype">double</span>&amp;<span class="keyword">&gt;</span>(r);</div>
<div class="line"><a name="l00238"></a><span class="lineno">  238</span>&#160;}</div>
<div class="line"><a name="l00239"></a><span class="lineno">  239</span>&#160;</div>
<div class="line"><a name="l00246"></a><span class="lineno"><a class="code" href="group__math.html#gaf9c3188aeeb64b61d3769108a0c845cd">  246</a></span>&#160;<span class="keywordtype">float</span> <span class="keyword">inline</span> <a class="code" href="group__math.html#gaf9c3188aeeb64b61d3769108a0c845cd" title="Calculate the sine of a specified angle, in radians. Single-precision.">sin</a>(<span class="keywordtype">float</span> x)</div>
<div class="line"><a name="l00247"></a><span class="lineno">  247</span>&#160;{</div>
<div class="line"><a name="l00248"></a><span class="lineno">  248</span>&#160;    uint32_t r = _SYS_sinf(reinterpret_cast&lt;uint32_t&amp;&gt;(x));</div>
<div class="line"><a name="l00249"></a><span class="lineno">  249</span>&#160;    <span class="keywordflow">return</span> <span class="keyword">reinterpret_cast&lt;</span><span class="keywordtype">float</span>&amp;<span class="keyword">&gt;</span>(r);</div>
<div class="line"><a name="l00250"></a><span class="lineno">  250</span>&#160;}</div>
<div class="line"><a name="l00251"></a><span class="lineno">  251</span>&#160;</div>
<div class="line"><a name="l00258"></a><span class="lineno"><a class="code" href="group__math.html#gac2d6750df5f8e49a1170b8f681502b13">  258</a></span>&#160;<span class="keywordtype">float</span> <span class="keyword">inline</span> <a class="code" href="group__math.html#gac2d6750df5f8e49a1170b8f681502b13" title="Calculate the cosine of a specified angle, in radians. Single-precision.">cos</a>(<span class="keywordtype">float</span> x)</div>
<div class="line"><a name="l00259"></a><span class="lineno">  259</span>&#160;{</div>
<div class="line"><a name="l00260"></a><span class="lineno">  260</span>&#160;    uint32_t r = _SYS_cosf(reinterpret_cast&lt;uint32_t&amp;&gt;(x));</div>
<div class="line"><a name="l00261"></a><span class="lineno">  261</span>&#160;    <span class="keywordflow">return</span> <span class="keyword">reinterpret_cast&lt;</span><span class="keywordtype">float</span>&amp;<span class="keyword">&gt;</span>(r);</div>
<div class="line"><a name="l00262"></a><span class="lineno">  262</span>&#160;}</div>
<div class="line"><a name="l00263"></a><span class="lineno">  263</span>&#160;</div>
<div class="line"><a name="l00265"></a><span class="lineno"><a class="code" href="group__math.html#ga552ba31837ff030ace32e39455344b2a">  265</a></span>&#160;<span class="keywordtype">float</span> <span class="keyword">inline</span> <a class="code" href="group__math.html#ga552ba31837ff030ace32e39455344b2a" title="Calculate the tangent of a specified angle, in radians. Single-precision.">tan</a>(<span class="keywordtype">float</span> x)</div>
<div class="line"><a name="l00266"></a><span class="lineno">  266</span>&#160;{</div>
<div class="line"><a name="l00267"></a><span class="lineno">  267</span>&#160;    uint32_t r = _SYS_tanf(reinterpret_cast&lt;uint32_t&amp;&gt;(x));</div>
<div class="line"><a name="l00268"></a><span class="lineno">  268</span>&#160;    <span class="keywordflow">return</span> <span class="keyword">reinterpret_cast&lt;</span><span class="keywordtype">float</span>&amp;<span class="keyword">&gt;</span>(r);</div>
<div class="line"><a name="l00269"></a><span class="lineno">  269</span>&#160;}</div>
<div class="line"><a name="l00270"></a><span class="lineno">  270</span>&#160;</div>
<div class="line"><a name="l00272"></a><span class="lineno"><a class="code" href="group__math.html#ga2cb197e1587bb5037269b8e5a93500a1">  272</a></span>&#160;<span class="keywordtype">float</span> <span class="keyword">inline</span> <a class="code" href="group__math.html#ga2cb197e1587bb5037269b8e5a93500a1" title="Single-precision arc tangent function, of one variable.">atan</a>(<span class="keywordtype">float</span> x)</div>
<div class="line"><a name="l00273"></a><span class="lineno">  273</span>&#160;{</div>
<div class="line"><a name="l00274"></a><span class="lineno">  274</span>&#160;    uint32_t r = _SYS_atanf(reinterpret_cast&lt;uint32_t&amp;&gt;(x));</div>
<div class="line"><a name="l00275"></a><span class="lineno">  275</span>&#160;    <span class="keywordflow">return</span> <span class="keyword">reinterpret_cast&lt;</span><span class="keywordtype">float</span>&amp;<span class="keyword">&gt;</span>(r);</div>
<div class="line"><a name="l00276"></a><span class="lineno">  276</span>&#160;}</div>
<div class="line"><a name="l00277"></a><span class="lineno">  277</span>&#160;</div>
<div class="line"><a name="l00284"></a><span class="lineno"><a class="code" href="group__math.html#gaa92d27de8e361aa4f3ec49835f2a1623">  284</a></span>&#160;<span class="keywordtype">float</span> <span class="keyword">inline</span> <a class="code" href="group__math.html#gaa92d27de8e361aa4f3ec49835f2a1623" title="Single-precision arc tangent function, of two variables.">atan2</a>(<span class="keywordtype">float</span> a, <span class="keywordtype">float</span> b)</div>
<div class="line"><a name="l00285"></a><span class="lineno">  285</span>&#160;{</div>
<div class="line"><a name="l00286"></a><span class="lineno">  286</span>&#160;    uint32_t r = _SYS_atan2f(reinterpret_cast&lt;uint32_t&amp;&gt;(a), reinterpret_cast&lt;uint32_t&amp;&gt;(b));</div>
<div class="line"><a name="l00287"></a><span class="lineno">  287</span>&#160;    <span class="keywordflow">return</span> <span class="keyword">reinterpret_cast&lt;</span><span class="keywordtype">float</span>&amp;<span class="keyword">&gt;</span>(r);</div>
<div class="line"><a name="l00288"></a><span class="lineno">  288</span>&#160;}</div>
<div class="line"><a name="l00289"></a><span class="lineno">  289</span>&#160;</div>
<div class="line"><a name="l00297"></a><span class="lineno"><a class="code" href="group__math.html#ga638c110b2937214ee62cbc7ddabad130">  297</a></span>&#160;<span class="keywordtype">void</span> <span class="keyword">inline</span> <a class="code" href="group__math.html#ga638c110b2937214ee62cbc7ddabad130" title="Simultaneously compute the sine and cosine of a specified angle, in radians.">sincos</a>(<span class="keywordtype">float</span> x, <span class="keywordtype">float</span> *s, <span class="keywordtype">float</span> *c)</div>
<div class="line"><a name="l00298"></a><span class="lineno">  298</span>&#160;{</div>
<div class="line"><a name="l00299"></a><span class="lineno">  299</span>&#160;    _SYS_sincosf(reinterpret_cast&lt;uint32_t&amp;&gt;(x), s, c);</div>
<div class="line"><a name="l00300"></a><span class="lineno">  300</span>&#160;}</div>
<div class="line"><a name="l00301"></a><span class="lineno">  301</span>&#160;</div>
<div class="line"><a name="l00309"></a><span class="lineno"><a class="code" href="group__math.html#ga652bc802d1b4491b90a1172f8d7e628b">  309</a></span>&#160;<span class="keywordtype">float</span> <span class="keyword">inline</span> <a class="code" href="group__math.html#ga652bc802d1b4491b90a1172f8d7e628b" title="Table-driven drop-in replacement for sin()">tsin</a>(<span class="keywordtype">float</span> x)</div>
<div class="line"><a name="l00310"></a><span class="lineno">  310</span>&#160;{</div>
<div class="line"><a name="l00311"></a><span class="lineno">  311</span>&#160;    uint32_t r = _SYS_tsinf(reinterpret_cast&lt;uint32_t&amp;&gt;(x));</div>
<div class="line"><a name="l00312"></a><span class="lineno">  312</span>&#160;    <span class="keywordflow">return</span> <span class="keyword">reinterpret_cast&lt;</span><span class="keywordtype">float</span>&amp;<span class="keyword">&gt;</span>(r);</div>
<div class="line"><a name="l00313"></a><span class="lineno">  313</span>&#160;}</div>
<div class="line"><a name="l00314"></a><span class="lineno">  314</span>&#160;</div>
<div class="line"><a name="l00322"></a><span class="lineno"><a class="code" href="group__math.html#gadd2bea115d12a254d0532c86fd247eb7">  322</a></span>&#160;<span class="keywordtype">float</span> <span class="keyword">inline</span> <a class="code" href="group__math.html#gadd2bea115d12a254d0532c86fd247eb7" title="Table-driven drop-in replacement for cos()">tcos</a>(<span class="keywordtype">float</span> x)</div>
<div class="line"><a name="l00323"></a><span class="lineno">  323</span>&#160;{</div>
<div class="line"><a name="l00324"></a><span class="lineno">  324</span>&#160;    uint32_t r = _SYS_tcosf(reinterpret_cast&lt;uint32_t&amp;&gt;(x));</div>
<div class="line"><a name="l00325"></a><span class="lineno">  325</span>&#160;    <span class="keywordflow">return</span> <span class="keyword">reinterpret_cast&lt;</span><span class="keywordtype">float</span>&amp;<span class="keyword">&gt;</span>(r);</div>
<div class="line"><a name="l00326"></a><span class="lineno">  326</span>&#160;}</div>
<div class="line"><a name="l00327"></a><span class="lineno">  327</span>&#160;</div>
<div class="line"><a name="l00342"></a><span class="lineno"><a class="code" href="group__math.html#ga26d92e54204a9ca8e496a930b3402ad4">  342</a></span>&#160;<span class="keywordtype">int</span> <span class="keyword">inline</span> <a class="code" href="group__math.html#ga26d92e54204a9ca8e496a930b3402ad4" title="Integer sine table lookup.">tsini</a>(<span class="keywordtype">int</span> x)</div>
<div class="line"><a name="l00343"></a><span class="lineno">  343</span>&#160;{</div>
<div class="line"><a name="l00344"></a><span class="lineno">  344</span>&#160;    <span class="keywordflow">return</span> _SYS_tsini(x);</div>
<div class="line"><a name="l00345"></a><span class="lineno">  345</span>&#160;}</div>
<div class="line"><a name="l00346"></a><span class="lineno">  346</span>&#160;</div>
<div class="line"><a name="l00362"></a><span class="lineno"><a class="code" href="group__math.html#gae3e036d15ed47bf3514d19f9796e76ee">  362</a></span>&#160;<span class="keywordtype">int</span> <span class="keyword">inline</span> <a class="code" href="group__math.html#gae3e036d15ed47bf3514d19f9796e76ee" title="Integer cosine table lookup.">tcosi</a>(<span class="keywordtype">int</span> x)</div>
<div class="line"><a name="l00363"></a><span class="lineno">  363</span>&#160;{</div>
<div class="line"><a name="l00364"></a><span class="lineno">  364</span>&#160;    <span class="keywordflow">return</span> _SYS_tcosi(x);</div>
<div class="line"><a name="l00365"></a><span class="lineno">  365</span>&#160;}</div>
<div class="line"><a name="l00366"></a><span class="lineno">  366</span>&#160;</div>
<div class="line"><a name="l00376"></a><span class="lineno"><a class="code" href="group__math.html#ga43a8cdf21fa4d18f07dec1720be2d837">  376</a></span>&#160;<span class="keywordtype">bool</span> <span class="keyword">inline</span> <a class="code" href="group__math.html#ga43a8cdf21fa4d18f07dec1720be2d837" title="Unordered comparison.">isunordered</a>(<span class="keywordtype">float</span> a, <span class="keywordtype">float</span> b = 0.f)</div>
<div class="line"><a name="l00377"></a><span class="lineno">  377</span>&#160;{</div>
<div class="line"><a name="l00378"></a><span class="lineno">  378</span>&#160;    <span class="keywordflow">return</span> __builtin_isunordered(a, b);</div>
<div class="line"><a name="l00379"></a><span class="lineno">  379</span>&#160;}</div>
<div class="line"><a name="l00380"></a><span class="lineno">  380</span>&#160;</div>
<div class="line"><a name="l00390"></a><span class="lineno"><a class="code" href="group__math.html#ga6fd63a5f35439ec6247bc7c6cb0acbc2">  390</a></span>&#160;<span class="keywordtype">bool</span> <span class="keyword">inline</span> <a class="code" href="group__math.html#ga43a8cdf21fa4d18f07dec1720be2d837" title="Unordered comparison.">isunordered</a>(<span class="keywordtype">double</span> a, <span class="keywordtype">double</span> b = 0.f)</div>
<div class="line"><a name="l00391"></a><span class="lineno">  391</span>&#160;{</div>
<div class="line"><a name="l00392"></a><span class="lineno">  392</span>&#160;    <span class="keywordflow">return</span> __builtin_isunordered(a, b);</div>
<div class="line"><a name="l00393"></a><span class="lineno">  393</span>&#160;}</div>
<div class="line"><a name="l00394"></a><span class="lineno">  394</span>&#160;</div>
<div class="line"><a name="l00407"></a><span class="lineno"><a class="code" href="group__math.html#ga012f41b1c87f89adb8db0d357762bc5b">  407</a></span>&#160;<span class="keyword">template</span> &lt;<span class="keyword">typename</span> T&gt; <span class="keyword">inline</span> <span class="keywordtype">long</span> <a class="code" href="group__math.html#ga012f41b1c87f89adb8db0d357762bc5b" title="Returns the next integer value closer to positive infinity from &#39;value&#39;.">ceil</a>(<span class="keyword">const</span> T value)</div>
<div class="line"><a name="l00408"></a><span class="lineno">  408</span>&#160;{</div>
<div class="line"><a name="l00409"></a><span class="lineno">  409</span>&#160;    <span class="keywordtype">long</span> result = value;</div>
<div class="line"><a name="l00410"></a><span class="lineno">  410</span>&#160;    <span class="keywordflow">if</span> (result &gt;= 0 &amp;&amp; result &lt; value) {</div>
<div class="line"><a name="l00411"></a><span class="lineno">  411</span>&#160;        <span class="keywordflow">return</span> result+1;</div>
<div class="line"><a name="l00412"></a><span class="lineno">  412</span>&#160;    }</div>
<div class="line"><a name="l00413"></a><span class="lineno">  413</span>&#160;    <span class="keywordflow">return</span> result;</div>
<div class="line"><a name="l00414"></a><span class="lineno">  414</span>&#160;}</div>
<div class="line"><a name="l00415"></a><span class="lineno">  415</span>&#160;</div>
<div class="line"><a name="l00428"></a><span class="lineno"><a class="code" href="group__math.html#ga4c9700ed238eb7178f6f4877598d2c8b">  428</a></span>&#160;<span class="keyword">template</span> &lt;<span class="keyword">typename</span> T&gt; <span class="keyword">inline</span> <span class="keywordtype">long</span> <a class="code" href="group__math.html#ga4c9700ed238eb7178f6f4877598d2c8b" title="Returns the next integer value closer to negative infinity from &#39;value&#39;.">floor</a>(<span class="keyword">const</span> T value)</div>
<div class="line"><a name="l00429"></a><span class="lineno">  429</span>&#160;{</div>
<div class="line"><a name="l00430"></a><span class="lineno">  430</span>&#160;   <span class="keywordtype">long</span> result = value;</div>
<div class="line"><a name="l00431"></a><span class="lineno">  431</span>&#160;   <span class="keywordflow">if</span> (result &lt;= 0 &amp;&amp; result &gt; value) {</div>
<div class="line"><a name="l00432"></a><span class="lineno">  432</span>&#160;       <span class="keywordflow">return</span> result - 1;</div>
<div class="line"><a name="l00433"></a><span class="lineno">  433</span>&#160;   }</div>
<div class="line"><a name="l00434"></a><span class="lineno">  434</span>&#160;   <span class="keywordflow">return</span> result;</div>
<div class="line"><a name="l00435"></a><span class="lineno">  435</span>&#160;}</div>
<div class="line"><a name="l00436"></a><span class="lineno">  436</span>&#160;</div>
<div class="line"><a name="l00450"></a><span class="lineno"><a class="code" href="group__math.html#ga1859c1422ddbe0ce404c4215613300fc">  450</a></span>&#160;<span class="keyword">template</span> &lt;<span class="keyword">typename</span> T&gt; <span class="keyword">inline</span> <span class="keywordtype">long</span> <a class="code" href="group__math.html#ga1859c1422ddbe0ce404c4215613300fc" title="Rounds &#39;value&#39; to the nearest whole value.">round</a>(<span class="keyword">const</span> T value)</div>
<div class="line"><a name="l00451"></a><span class="lineno">  451</span>&#160;{</div>
<div class="line"><a name="l00452"></a><span class="lineno">  452</span>&#160;    <span class="keywordflow">return</span> <a class="code" href="group__math.html#ga4c9700ed238eb7178f6f4877598d2c8b" title="Returns the next integer value closer to negative infinity from &#39;value&#39;.">floor</a>(value + 0.5);</div>
<div class="line"><a name="l00453"></a><span class="lineno">  453</span>&#160;}</div>
<div class="line"><a name="l00454"></a><span class="lineno">  454</span>&#160;</div>
<div class="line"><a name="l00459"></a><span class="lineno"><a class="code" href="group__math.html#gaf8dd59f9dcdfebc7490e3a12c719812c">  459</a></span>&#160;<span class="keyword">template</span> &lt;<span class="keyword">typename</span> T&gt; <span class="keyword">inline</span> <span class="keywordtype">bool</span> <a class="code" href="group__math.html#gaf8dd59f9dcdfebc7490e3a12c719812c" title="Returns true when &#39;a&#39; and &#39;b&#39; are within &#39;epsilon&#39; of each other.">almostEqual</a>(<span class="keyword">const</span> T a, <span class="keyword">const</span> T b, <span class="keyword">const</span> T epsilon)</div>
<div class="line"><a name="l00460"></a><span class="lineno">  460</span>&#160;{</div>
<div class="line"><a name="l00461"></a><span class="lineno">  461</span>&#160;    <span class="keywordflow">return</span> <a class="code" href="group__math.html#gadfdd37c09079cfe60965b09b186a24f0" title="For any type, return the absolute value.">abs</a>(a-b) &lt; epsilon;</div>
<div class="line"><a name="l00462"></a><span class="lineno">  462</span>&#160;}</div>
<div class="line"><a name="l00463"></a><span class="lineno">  463</span>&#160;</div>
<div class="line"><a name="l00464"></a><span class="lineno">  464</span>&#160;</div>
<div class="line"><a name="l00469"></a><span class="lineno"><a class="code" href="struct_sifteo_1_1_vector2.html">  469</a></span>&#160;<span class="keyword">template</span> &lt;<span class="keyword">typename</span> T&gt; <span class="keyword">struct </span><a class="code" href="struct_sifteo_1_1_vector2.html" title="Generalized two-element cartesian coordinate vector.">Vector2</a> {</div>
<div class="line"><a name="l00470"></a><span class="lineno"><a class="code" href="struct_sifteo_1_1_vector2.html#a7362956454caca88012382934a1e94b9">  470</a></span>&#160;    T <a class="code" href="struct_sifteo_1_1_vector2.html#a7362956454caca88012382934a1e94b9" title="Vector component X.">x</a>;    </div>
<div class="line"><a name="l00471"></a><span class="lineno"><a class="code" href="struct_sifteo_1_1_vector2.html#a6ef946409dc8f1fb0fb21f158ad12bec">  471</a></span>&#160;    T <a class="code" href="struct_sifteo_1_1_vector2.html#a6ef946409dc8f1fb0fb21f158ad12bec" title="Vector component Y.">y</a>;    </div>
<div class="line"><a name="l00472"></a><span class="lineno">  472</span>&#160;</div>
<div class="line"><a name="l00476"></a><span class="lineno"><a class="code" href="struct_sifteo_1_1_vector2.html#a2cfe5a2ec34454542cb3f47e374c1a1c">  476</a></span>&#160;    <span class="keywordtype">void</span> <span class="keyword">set</span>(T _x, T _y) {</div>
<div class="line"><a name="l00477"></a><span class="lineno">  477</span>&#160;        <a class="code" href="struct_sifteo_1_1_vector2.html#a7362956454caca88012382934a1e94b9" title="Vector component X.">x</a> = _x;</div>
<div class="line"><a name="l00478"></a><span class="lineno">  478</span>&#160;        <a class="code" href="struct_sifteo_1_1_vector2.html#a6ef946409dc8f1fb0fb21f158ad12bec" title="Vector component Y.">y</a> = _y;</div>
<div class="line"><a name="l00479"></a><span class="lineno">  479</span>&#160;    }</div>
<div class="line"><a name="l00480"></a><span class="lineno">  480</span>&#160;</div>
<div class="line"><a name="l00484"></a><span class="lineno"><a class="code" href="struct_sifteo_1_1_vector2.html#abe1eadf7f2797aaaa8050f79713a54ff">  484</a></span>&#160;    <span class="keywordtype">void</span> <a class="code" href="struct_sifteo_1_1_vector2.html#abe1eadf7f2797aaaa8050f79713a54ff" title="Set this vector to a new cartesian value, given a value in polar coordinates.">setPolar</a>(<span class="keywordtype">float</span> angle, <span class="keywordtype">float</span> magnitude) {</div>
<div class="line"><a name="l00485"></a><span class="lineno">  485</span>&#160;        <span class="keywordtype">float</span> s, c;</div>
<div class="line"><a name="l00486"></a><span class="lineno">  486</span>&#160;        <a class="code" href="group__math.html#ga638c110b2937214ee62cbc7ddabad130" title="Simultaneously compute the sine and cosine of a specified angle, in radians.">sincos</a>(angle, &amp;s, &amp;c);</div>
<div class="line"><a name="l00487"></a><span class="lineno">  487</span>&#160;        <a class="code" href="struct_sifteo_1_1_vector2.html#a7362956454caca88012382934a1e94b9" title="Vector component X.">x</a> = c * magnitude;</div>
<div class="line"><a name="l00488"></a><span class="lineno">  488</span>&#160;        <a class="code" href="struct_sifteo_1_1_vector2.html#a6ef946409dc8f1fb0fb21f158ad12bec" title="Vector component Y.">y</a> = s * magnitude;</div>
<div class="line"><a name="l00489"></a><span class="lineno">  489</span>&#160;    }</div>
<div class="line"><a name="l00490"></a><span class="lineno">  490</span>&#160;</div>
<div class="line"><a name="l00494"></a><span class="lineno"><a class="code" href="struct_sifteo_1_1_vector2.html#a042a8b449943323d320817177fefd746">  494</a></span>&#160;    <a class="code" href="struct_sifteo_1_1_vector2.html" title="Generalized two-element cartesian coordinate vector.">Vector2&lt;T&gt;</a> <a class="code" href="struct_sifteo_1_1_vector2.html#a042a8b449943323d320817177fefd746" title="Rotate this vector about the origin counterclockwise by &#39;angle&#39; radians.">rotate</a>(<span class="keywordtype">float</span> angle)<span class="keyword"> const </span>{</div>
<div class="line"><a name="l00495"></a><span class="lineno">  495</span>&#160;        <span class="keywordtype">float</span> s, c;</div>
<div class="line"><a name="l00496"></a><span class="lineno">  496</span>&#160;        <a class="code" href="group__math.html#ga638c110b2937214ee62cbc7ddabad130" title="Simultaneously compute the sine and cosine of a specified angle, in radians.">sincos</a>(angle, &amp;s, &amp;c);</div>
<div class="line"><a name="l00497"></a><span class="lineno">  497</span>&#160;        <a class="code" href="struct_sifteo_1_1_vector2.html" title="Generalized two-element cartesian coordinate vector.">Vector2&lt;T&gt;</a> result = { <a class="code" href="struct_sifteo_1_1_vector2.html#a7362956454caca88012382934a1e94b9" title="Vector component X.">x</a>*c - <a class="code" href="struct_sifteo_1_1_vector2.html#a6ef946409dc8f1fb0fb21f158ad12bec" title="Vector component Y.">y</a>*s, <a class="code" href="struct_sifteo_1_1_vector2.html#a7362956454caca88012382934a1e94b9" title="Vector component X.">x</a>*s + <a class="code" href="struct_sifteo_1_1_vector2.html#a6ef946409dc8f1fb0fb21f158ad12bec" title="Vector component Y.">y</a>*c };</div>
<div class="line"><a name="l00498"></a><span class="lineno">  498</span>&#160;        <span class="keywordflow">return</span> result;</div>
<div class="line"><a name="l00499"></a><span class="lineno">  499</span>&#160;    }</div>
<div class="line"><a name="l00500"></a><span class="lineno">  500</span>&#160;</div>
<div class="line"><a name="l00509"></a><span class="lineno"><a class="code" href="struct_sifteo_1_1_vector2.html#ade12515c7e8450255a50fcf594ab2107">  509</a></span>&#160;    <a class="code" href="struct_sifteo_1_1_vector2.html" title="Generalized two-element cartesian coordinate vector.">Vector2&lt;T&gt;</a> <a class="code" href="struct_sifteo_1_1_vector2.html#ade12515c7e8450255a50fcf594ab2107" title="Rotate this vector about the origin counterclockwise by an integer multiple of 90 degrees...">rotateI</a>(<span class="keywordtype">int</span> angle)<span class="keyword"> const </span>{</div>
<div class="line"><a name="l00510"></a><span class="lineno">  510</span>&#160;        <a class="code" href="struct_sifteo_1_1_vector2.html" title="Generalized two-element cartesian coordinate vector.">Vector2&lt;T&gt;</a> a1 = { -<a class="code" href="struct_sifteo_1_1_vector2.html#a6ef946409dc8f1fb0fb21f158ad12bec" title="Vector component Y.">y</a>,  <a class="code" href="struct_sifteo_1_1_vector2.html#a7362956454caca88012382934a1e94b9" title="Vector component X.">x</a> };</div>
<div class="line"><a name="l00511"></a><span class="lineno">  511</span>&#160;        <a class="code" href="struct_sifteo_1_1_vector2.html" title="Generalized two-element cartesian coordinate vector.">Vector2&lt;T&gt;</a> a2 = { -<a class="code" href="struct_sifteo_1_1_vector2.html#a7362956454caca88012382934a1e94b9" title="Vector component X.">x</a>, -<a class="code" href="struct_sifteo_1_1_vector2.html#a6ef946409dc8f1fb0fb21f158ad12bec" title="Vector component Y.">y</a> };</div>
<div class="line"><a name="l00512"></a><span class="lineno">  512</span>&#160;        <a class="code" href="struct_sifteo_1_1_vector2.html" title="Generalized two-element cartesian coordinate vector.">Vector2&lt;T&gt;</a> a3 = {  <a class="code" href="struct_sifteo_1_1_vector2.html#a6ef946409dc8f1fb0fb21f158ad12bec" title="Vector component Y.">y</a>, -<a class="code" href="struct_sifteo_1_1_vector2.html#a7362956454caca88012382934a1e94b9" title="Vector component X.">x</a> };</div>
<div class="line"><a name="l00513"></a><span class="lineno">  513</span>&#160;        <span class="keywordflow">switch</span> (angle) {</div>
<div class="line"><a name="l00514"></a><span class="lineno">  514</span>&#160;            <span class="keywordflow">default</span>: <a class="code" href="group__macros.html#ga8a15779356736a0900a162442b1cda53" title="Runtime debug assertion.">ASSERT</a>(0);</div>
<div class="line"><a name="l00515"></a><span class="lineno">  515</span>&#160;            <span class="keywordflow">case</span> 0: <span class="keywordflow">return</span> *<span class="keyword">this</span>;</div>
<div class="line"><a name="l00516"></a><span class="lineno">  516</span>&#160;            <span class="keywordflow">case</span> 1: <span class="keywordflow">return</span> a1;</div>
<div class="line"><a name="l00517"></a><span class="lineno">  517</span>&#160;            <span class="keywordflow">case</span> 2: <span class="keywordflow">return</span> a2;</div>
<div class="line"><a name="l00518"></a><span class="lineno">  518</span>&#160;            <span class="keywordflow">case</span> 3: <span class="keywordflow">return</span> a3;</div>
<div class="line"><a name="l00519"></a><span class="lineno">  519</span>&#160;        }</div>
<div class="line"><a name="l00520"></a><span class="lineno">  520</span>&#160;    }</div>
<div class="line"><a name="l00521"></a><span class="lineno">  521</span>&#160;</div>
<div class="line"><a name="l00530"></a><span class="lineno"><a class="code" href="struct_sifteo_1_1_vector2.html#a0eb0713d12c56bffdbbdb8d896a586d1">  530</a></span>&#160;    <span class="keyword">static</span> <a class="code" href="struct_sifteo_1_1_vector2.html" title="Generalized two-element cartesian coordinate vector.">Vector2&lt;T&gt;</a> <a class="code" href="struct_sifteo_1_1_vector2.html#a0eb0713d12c56bffdbbdb8d896a586d1" title="Create a unit vector corresponding to the given integer &#39;side&#39;.">unit</a>(<span class="keywordtype">int</span> side) {</div>
<div class="line"><a name="l00531"></a><span class="lineno">  531</span>&#160;        <a class="code" href="struct_sifteo_1_1_vector2.html" title="Generalized two-element cartesian coordinate vector.">Vector2&lt;T&gt;</a> a0 = {  0, -1 };</div>
<div class="line"><a name="l00532"></a><span class="lineno">  532</span>&#160;        <a class="code" href="struct_sifteo_1_1_vector2.html" title="Generalized two-element cartesian coordinate vector.">Vector2&lt;T&gt;</a> a1 = { -1,  0 };</div>
<div class="line"><a name="l00533"></a><span class="lineno">  533</span>&#160;        <a class="code" href="struct_sifteo_1_1_vector2.html" title="Generalized two-element cartesian coordinate vector.">Vector2&lt;T&gt;</a> a2 = {  0,  1 };</div>
<div class="line"><a name="l00534"></a><span class="lineno">  534</span>&#160;        <a class="code" href="struct_sifteo_1_1_vector2.html" title="Generalized two-element cartesian coordinate vector.">Vector2&lt;T&gt;</a> a3 = {  1,  0 };</div>
<div class="line"><a name="l00535"></a><span class="lineno">  535</span>&#160;        <span class="keywordflow">switch</span>(side) {</div>
<div class="line"><a name="l00536"></a><span class="lineno">  536</span>&#160;            <span class="keywordflow">default</span>: <a class="code" href="group__macros.html#ga8a15779356736a0900a162442b1cda53" title="Runtime debug assertion.">ASSERT</a>(0);</div>
<div class="line"><a name="l00537"></a><span class="lineno">  537</span>&#160;            <span class="keywordflow">case</span> 0: <span class="keywordflow">return</span> a0;</div>
<div class="line"><a name="l00538"></a><span class="lineno">  538</span>&#160;            <span class="keywordflow">case</span> 1: <span class="keywordflow">return</span> a1;</div>
<div class="line"><a name="l00539"></a><span class="lineno">  539</span>&#160;            <span class="keywordflow">case</span> 2: <span class="keywordflow">return</span> a2;</div>
<div class="line"><a name="l00540"></a><span class="lineno">  540</span>&#160;            <span class="keywordflow">case</span> 3: <span class="keywordflow">return</span> a3;</div>
<div class="line"><a name="l00541"></a><span class="lineno">  541</span>&#160;        }</div>
<div class="line"><a name="l00542"></a><span class="lineno">  542</span>&#160;    }</div>
<div class="line"><a name="l00543"></a><span class="lineno">  543</span>&#160;</div>
<div class="line"><a name="l00549"></a><span class="lineno"><a class="code" href="struct_sifteo_1_1_vector2.html#a8619b4e08d26a352c6e5ce39b6f13abf">  549</a></span>&#160;    T <a class="code" href="struct_sifteo_1_1_vector2.html#a8619b4e08d26a352c6e5ce39b6f13abf" title="Calculate the scalar length (magnitude) of this vector, squared.">len2</a>()<span class="keyword"> const </span>{</div>
<div class="line"><a name="l00550"></a><span class="lineno">  550</span>&#160;        <span class="keywordflow">return</span> ( <a class="code" href="struct_sifteo_1_1_vector2.html#a7362956454caca88012382934a1e94b9" title="Vector component X.">x</a> * <a class="code" href="struct_sifteo_1_1_vector2.html#a7362956454caca88012382934a1e94b9" title="Vector component X.">x</a> + <a class="code" href="struct_sifteo_1_1_vector2.html#a6ef946409dc8f1fb0fb21f158ad12bec" title="Vector component Y.">y</a> * <a class="code" href="struct_sifteo_1_1_vector2.html#a6ef946409dc8f1fb0fb21f158ad12bec" title="Vector component Y.">y</a> );</div>
<div class="line"><a name="l00551"></a><span class="lineno">  551</span>&#160;    }</div>
<div class="line"><a name="l00552"></a><span class="lineno">  552</span>&#160;</div>
<div class="line"><a name="l00556"></a><span class="lineno"><a class="code" href="struct_sifteo_1_1_vector2.html#ab5a6d609ccae73660eb745297e3b790e">  556</a></span>&#160;    T <a class="code" href="struct_sifteo_1_1_vector2.html#ab5a6d609ccae73660eb745297e3b790e" title="Calculate the scalar length (magnitude) of this vector.">len</a>()<span class="keyword"> const </span>{</div>
<div class="line"><a name="l00557"></a><span class="lineno">  557</span>&#160;        <span class="keywordflow">return</span> <a class="code" href="group__math.html#ga20311b4dc8c3af67579a2517c36e2e4e" title="Compute the square root of a floating point number. Single-precision.">sqrt</a>(<a class="code" href="struct_sifteo_1_1_vector2.html#a8619b4e08d26a352c6e5ce39b6f13abf" title="Calculate the scalar length (magnitude) of this vector, squared.">len2</a>());</div>
<div class="line"><a name="l00558"></a><span class="lineno">  558</span>&#160;    }</div>
<div class="line"><a name="l00559"></a><span class="lineno">  559</span>&#160;</div>
<div class="line"><a name="l00563"></a><span class="lineno"><a class="code" href="struct_sifteo_1_1_vector2.html#ad86b462601733010d25d3433f63f49b7">  563</a></span>&#160;    T <a class="code" href="struct_sifteo_1_1_vector2.html#ad86b462601733010d25d3433f63f49b7" title="Calculate the manhattan (city block) distance of this vector.">lenManhattan</a>()<span class="keyword"> const </span>{</div>
<div class="line"><a name="l00564"></a><span class="lineno">  564</span>&#160;        <span class="keywordflow">return</span> <a class="code" href="group__math.html#gadfdd37c09079cfe60965b09b186a24f0" title="For any type, return the absolute value.">abs</a>(<a class="code" href="struct_sifteo_1_1_vector2.html#a7362956454caca88012382934a1e94b9" title="Vector component X.">x</a>) + <a class="code" href="group__math.html#gadfdd37c09079cfe60965b09b186a24f0" title="For any type, return the absolute value.">abs</a>(<a class="code" href="struct_sifteo_1_1_vector2.html#a6ef946409dc8f1fb0fb21f158ad12bec" title="Vector component Y.">y</a>);</div>
<div class="line"><a name="l00565"></a><span class="lineno">  565</span>&#160;    }</div>
<div class="line"><a name="l00566"></a><span class="lineno">  566</span>&#160;</div>
<div class="line"><a name="l00572"></a><span class="lineno"><a class="code" href="struct_sifteo_1_1_vector2.html#a2ab9f95e671b151a285edbf5d9e3910a">  572</a></span>&#160;    <a class="code" href="struct_sifteo_1_1_vector2.html" title="Generalized two-element cartesian coordinate vector.">Vector2&lt;T&gt;</a> <a class="code" href="struct_sifteo_1_1_vector2.html#a2ab9f95e671b151a285edbf5d9e3910a" title="Return a normalized version of this vector.">normalize</a>()<span class="keyword"> const </span>{</div>
<div class="line"><a name="l00573"></a><span class="lineno">  573</span>&#160;        <span class="keywordflow">return</span> *<span class="keyword">this</span> / <a class="code" href="struct_sifteo_1_1_vector2.html#ab5a6d609ccae73660eb745297e3b790e" title="Calculate the scalar length (magnitude) of this vector.">len</a>();</div>
<div class="line"><a name="l00574"></a><span class="lineno">  574</span>&#160;    }</div>
<div class="line"><a name="l00575"></a><span class="lineno">  575</span>&#160;    </div>
<div class="line"><a name="l00579"></a><span class="lineno"><a class="code" href="struct_sifteo_1_1_vector2.html#a7995e139a1436a81b9ae11e05701dabf">  579</a></span>&#160;    <a class="code" href="struct_sifteo_1_1_vector2.html" title="Generalized two-element cartesian coordinate vector.">Vector2&lt;int&gt;</a> <a class="code" href="struct_sifteo_1_1_vector2.html#a7995e139a1436a81b9ae11e05701dabf" title="Round a floating point vector to the nearest integer.">round</a>()<span class="keyword"> const </span>{</div>
<div class="line"><a name="l00580"></a><span class="lineno">  580</span>&#160;        <a class="code" href="struct_sifteo_1_1_vector2.html" title="Generalized two-element cartesian coordinate vector.">Vector2&lt;int&gt;</a> result = { <a class="code" href="struct_sifteo_1_1_vector2.html#a7362956454caca88012382934a1e94b9" title="Vector component X.">x</a> + 0.5f, <a class="code" href="struct_sifteo_1_1_vector2.html#a6ef946409dc8f1fb0fb21f158ad12bec" title="Vector component Y.">y</a> + 0.5f };</div>
<div class="line"><a name="l00581"></a><span class="lineno">  581</span>&#160;        <span class="keywordflow">return</span> result;</div>
<div class="line"><a name="l00582"></a><span class="lineno">  582</span>&#160;    }</div>
<div class="line"><a name="l00583"></a><span class="lineno">  583</span>&#160;</div>
<div class="line"><a name="l00588"></a><span class="lineno"><a class="code" href="struct_sifteo_1_1_vector2.html#a6c3dc401b4427e61b2f7489b1c7f127f">  588</a></span>&#160;    <span class="keyword">template</span> &lt;<span class="keyword">typename</span> R&gt; <a class="code" href="struct_sifteo_1_1_vector2.html" title="Generalized two-element cartesian coordinate vector.">Vector2&lt;R&gt;</a> <a class="code" href="struct_sifteo_1_1_vector2.html#a6c3dc401b4427e61b2f7489b1c7f127f" title="Explicitly cast this vector to another vector type, using default C++ truncation or extension rules...">cast</a>()<span class="keyword"> const </span>{</div>
<div class="line"><a name="l00589"></a><span class="lineno">  589</span>&#160;        <a class="code" href="struct_sifteo_1_1_vector2.html" title="Generalized two-element cartesian coordinate vector.">Vector2&lt;R&gt;</a> result = { <a class="code" href="struct_sifteo_1_1_vector2.html#a7362956454caca88012382934a1e94b9" title="Vector component X.">x</a>, <a class="code" href="struct_sifteo_1_1_vector2.html#a6ef946409dc8f1fb0fb21f158ad12bec" title="Vector component Y.">y</a> };</div>
<div class="line"><a name="l00590"></a><span class="lineno">  590</span>&#160;        <span class="keywordflow">return</span> result;</div>
<div class="line"><a name="l00591"></a><span class="lineno">  591</span>&#160;    }</div>
<div class="line"><a name="l00592"></a><span class="lineno">  592</span>&#160;</div>
<div class="line"><a name="l00599"></a><span class="lineno"><a class="code" href="struct_sifteo_1_1_vector2.html#af6a9e2e0b6e3ea161a7f4082985640e2">  599</a></span>&#160;    <a class="code" href="struct_sifteo_1_1_vector2.html" title="Generalized two-element cartesian coordinate vector.">Vector2&lt;T&gt;</a> <a class="code" href="struct_sifteo_1_1_vector2.html#af6a9e2e0b6e3ea161a7f4082985640e2" title="Complex multiplication.">cmul</a>(<a class="code" href="struct_sifteo_1_1_vector2.html" title="Generalized two-element cartesian coordinate vector.">Vector2&lt;T&gt;</a> u)<span class="keyword"> const </span>{</div>
<div class="line"><a name="l00600"></a><span class="lineno">  600</span>&#160;        <a class="code" href="struct_sifteo_1_1_vector2.html" title="Generalized two-element cartesian coordinate vector.">Vector2&lt;T&gt;</a> result = { <a class="code" href="struct_sifteo_1_1_vector2.html#a7362956454caca88012382934a1e94b9" title="Vector component X.">x</a>*u.<a class="code" href="struct_sifteo_1_1_vector2.html#a7362956454caca88012382934a1e94b9" title="Vector component X.">x</a> - <a class="code" href="struct_sifteo_1_1_vector2.html#a6ef946409dc8f1fb0fb21f158ad12bec" title="Vector component Y.">y</a>*u.<a class="code" href="struct_sifteo_1_1_vector2.html#a6ef946409dc8f1fb0fb21f158ad12bec" title="Vector component Y.">y</a>, <a class="code" href="struct_sifteo_1_1_vector2.html#a7362956454caca88012382934a1e94b9" title="Vector component X.">x</a>*u.<a class="code" href="struct_sifteo_1_1_vector2.html#a6ef946409dc8f1fb0fb21f158ad12bec" title="Vector component Y.">y</a> + <a class="code" href="struct_sifteo_1_1_vector2.html#a6ef946409dc8f1fb0fb21f158ad12bec" title="Vector component Y.">y</a>*u.<a class="code" href="struct_sifteo_1_1_vector2.html#a7362956454caca88012382934a1e94b9" title="Vector component X.">x</a> };</div>
<div class="line"><a name="l00601"></a><span class="lineno">  601</span>&#160;        <span class="keywordflow">return</span> result;</div>
<div class="line"><a name="l00602"></a><span class="lineno">  602</span>&#160;    }</div>
<div class="line"><a name="l00603"></a><span class="lineno">  603</span>&#160;</div>
<div class="line"><a name="l00605"></a><span class="lineno"><a class="code" href="struct_sifteo_1_1_vector2.html#af333727569cabe881f2d99ab38989552">  605</a></span>&#160;    <a class="code" href="struct_sifteo_1_1_vector2.html" title="Generalized two-element cartesian coordinate vector.">Vector2&lt;int&gt;</a> <a class="code" href="struct_sifteo_1_1_vector2.html#af333727569cabe881f2d99ab38989552" title="Explicit cast to int.">toInt</a>()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> cast&lt;int&gt;(); }</div>
<div class="line"><a name="l00607"></a><span class="lineno"><a class="code" href="struct_sifteo_1_1_vector2.html#a220201952b2744c3fb7228f697937826">  607</a></span>&#160;    <a class="code" href="struct_sifteo_1_1_vector2.html">Vector2&lt;float&gt;</a> <a class="code" href="struct_sifteo_1_1_vector2.html#a220201952b2744c3fb7228f697937826" title="Explicit cast to float.">toFloat</a>()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> cast&lt;float&gt;(); }</div>
<div class="line"><a name="l00609"></a><span class="lineno"><a class="code" href="struct_sifteo_1_1_vector2.html#aa4e19356709913baf0af5d186246488c">  609</a></span>&#160;    <a class="code" href="struct_sifteo_1_1_vector2.html" title="Generalized two-element cartesian coordinate vector.">Vector2&lt;double&gt;</a> <a class="code" href="struct_sifteo_1_1_vector2.html#aa4e19356709913baf0af5d186246488c" title="Explicit cast to double.">toDouble</a>()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> cast&lt;double&gt;(); }</div>
<div class="line"><a name="l00610"></a><span class="lineno">  610</span>&#160;    </div>
<div class="line"><a name="l00611"></a><span class="lineno">  611</span>&#160;    <span class="comment">// Implicit casts</span></div>
<div class="line"><a name="l00612"></a><span class="lineno">  612</span>&#160;    <span class="keyword">operator</span> <a class="code" href="struct_sifteo_1_1_vector2.html" title="Generalized two-element cartesian coordinate vector.">Vector2&lt;int&gt;</a>            () <span class="keyword">const</span> { <span class="keywordflow">return</span> cast&lt;int&gt;(); }</div>
<div class="line"><a name="l00613"></a><span class="lineno">  613</span>&#160;    <span class="keyword">operator</span> Vector2&lt;unsigned&gt;       () <span class="keyword">const</span> { <span class="keywordflow">return</span> cast&lt;unsigned&gt;(); }</div>
<div class="line"><a name="l00614"></a><span class="lineno">  614</span>&#160;    <span class="keyword">operator</span> Vector2&lt;short&gt;          () <span class="keyword">const</span> { <span class="keywordflow">return</span> cast&lt;short&gt;(); }</div>
<div class="line"><a name="l00615"></a><span class="lineno">  615</span>&#160;    <span class="keyword">operator</span> Vector2&lt;unsigned short&gt; () <span class="keyword">const</span> { <span class="keywordflow">return</span> cast&lt;unsigned short&gt;(); }</div>
<div class="line"><a name="l00616"></a><span class="lineno">  616</span>&#160;    <span class="keyword">operator</span> Vector2&lt;int8_t&gt;         () <span class="keyword">const</span> { <span class="keywordflow">return</span> cast&lt;int8_t&gt;(); }</div>
<div class="line"><a name="l00617"></a><span class="lineno">  617</span>&#160;    <span class="keyword">operator</span> Vector2&lt;uint8_t&gt;        () <span class="keyword">const</span> { <span class="keywordflow">return</span> cast&lt;uint8_t&gt;(); }</div>
<div class="line"><a name="l00618"></a><span class="lineno">  618</span>&#160;    <span class="keyword">operator</span> Vector2&lt;float&gt;          () <span class="keyword">const</span> { <span class="keywordflow">return</span> cast&lt;float&gt;(); }</div>
<div class="line"><a name="l00619"></a><span class="lineno">  619</span>&#160;    <span class="keyword">operator</span> Vector2&lt;double&gt;         () <span class="keyword">const</span> { <span class="keywordflow">return</span> cast&lt;double&gt;(); }</div>
<div class="line"><a name="l00620"></a><span class="lineno">  620</span>&#160;};</div>
<div class="line"><a name="l00621"></a><span class="lineno">  621</span>&#160;</div>
<div class="line"><a name="l00622"></a><span class="lineno"><a class="code" href="group__math.html#ga4aa5e1c76d3adebd72a73a7051ad1fe0">  622</a></span>&#160;<span class="keyword">typedef</span> <a class="code" href="struct_sifteo_1_1_vector2.html" title="Generalized two-element cartesian coordinate vector.">Vector2&lt;int&gt;</a>                <a class="code" href="group__math.html#ga4aa5e1c76d3adebd72a73a7051ad1fe0" title="Typedef for a 2-vector of ints.">Int2</a>;       </div>
<div class="line"><a name="l00623"></a><span class="lineno"><a class="code" href="group__math.html#ga2e4fcb4037bc16967e23c20126d25396">  623</a></span>&#160;<span class="keyword">typedef</span> <a class="code" href="struct_sifteo_1_1_vector2.html" title="Generalized two-element cartesian coordinate vector.">Vector2&lt;unsigned&gt;</a>           <a class="code" href="group__math.html#ga2e4fcb4037bc16967e23c20126d25396" title="Typedef for a 2-vector of unsigned ints.">UInt2</a>;      </div>
<div class="line"><a name="l00624"></a><span class="lineno"><a class="code" href="group__math.html#ga4b7628e29e2b48dca071eeb4dc426852">  624</a></span>&#160;<span class="keyword">typedef</span> <a class="code" href="struct_sifteo_1_1_vector2.html" title="Generalized two-element cartesian coordinate vector.">Vector2&lt;short&gt;</a>              <a class="code" href="group__math.html#ga4b7628e29e2b48dca071eeb4dc426852" title="Typedef for a 2-vector of shorts.">Short2</a>;     </div>
<div class="line"><a name="l00625"></a><span class="lineno"><a class="code" href="group__math.html#ga9158a84114b141c31959181d043b7eef">  625</a></span>&#160;<span class="keyword">typedef</span> <a class="code" href="struct_sifteo_1_1_vector2.html" title="Generalized two-element cartesian coordinate vector.">Vector2&lt;unsigned short&gt;</a>     <a class="code" href="group__math.html#ga9158a84114b141c31959181d043b7eef" title="Typedef for a 2-vector of unsigned shorts.">UShort2</a>;    </div>
<div class="line"><a name="l00626"></a><span class="lineno"><a class="code" href="group__math.html#ga646e59d09468008d8b58afeb33a49b38">  626</a></span>&#160;<span class="keyword">typedef</span> <a class="code" href="struct_sifteo_1_1_vector2.html" title="Generalized two-element cartesian coordinate vector.">Vector2&lt;int8_t&gt;</a>             <a class="code" href="group__math.html#ga646e59d09468008d8b58afeb33a49b38" title="Typedef for a 2-vector of bytes.">Byte2</a>;      </div>
<div class="line"><a name="l00627"></a><span class="lineno"><a class="code" href="group__math.html#gadad7b6303d3c62a27f4ee78e3cdd29b6">  627</a></span>&#160;<span class="keyword">typedef</span> <a class="code" href="struct_sifteo_1_1_vector2.html" title="Generalized two-element cartesian coordinate vector.">Vector2&lt;uint8_t&gt;</a>            <a class="code" href="group__math.html#gadad7b6303d3c62a27f4ee78e3cdd29b6" title="Typedef for a 2-vector of unsigned bytes.">UByte2</a>;     </div>
<div class="line"><a name="l00628"></a><span class="lineno"><a class="code" href="group__math.html#ga142c5de33f25b2f04428b16b309c9765">  628</a></span>&#160;<span class="keyword">typedef</span> <a class="code" href="struct_sifteo_1_1_vector2.html">Vector2&lt;float&gt;</a>              <a class="code" href="group__math.html#ga142c5de33f25b2f04428b16b309c9765" title="Typedef for a 2-vector of floats.">Float2</a>;     </div>
<div class="line"><a name="l00629"></a><span class="lineno"><a class="code" href="group__math.html#ga2de6d1897dbf008f866b526a08c3707f">  629</a></span>&#160;<span class="keyword">typedef</span> <a class="code" href="struct_sifteo_1_1_vector2.html" title="Generalized two-element cartesian coordinate vector.">Vector2&lt;double&gt;</a>             <a class="code" href="group__math.html#ga2de6d1897dbf008f866b526a08c3707f" title="Typedef for a 2-vector of double-precision floats.">Double2</a>;    </div>
<div class="line"><a name="l00630"></a><span class="lineno">  630</span>&#160;</div>
<div class="line"><a name="l00639"></a><span class="lineno"><a class="code" href="group__math.html#gab18c9af04a4a3a4a3c63656e40ab74ed">  639</a></span>&#160;<span class="keyword">template</span> &lt;<span class="keyword">typename</span> T&gt; <span class="keyword">inline</span> <a class="code" href="struct_sifteo_1_1_vector2.html" title="Generalized two-element cartesian coordinate vector.">Vector2&lt;T&gt;</a> <a class="code" href="group__math.html#gab18c9af04a4a3a4a3c63656e40ab74ed" title="Create a Vector2, from a set of (x,y) coordinates.">vec</a>(T x, T y) {</div>
<div class="line"><a name="l00640"></a><span class="lineno">  640</span>&#160;    <a class="code" href="struct_sifteo_1_1_vector2.html" title="Generalized two-element cartesian coordinate vector.">Vector2&lt;T&gt;</a> result = { x, y };</div>
<div class="line"><a name="l00641"></a><span class="lineno">  641</span>&#160;    <span class="keywordflow">return</span> result;</div>
<div class="line"><a name="l00642"></a><span class="lineno">  642</span>&#160;}</div>
<div class="line"><a name="l00643"></a><span class="lineno">  643</span>&#160;</div>
<div class="line"><a name="l00645"></a><span class="lineno"><a class="code" href="group__math.html#gaed7c12b9ab92540d789a1a4322bafff3">  645</a></span>&#160;<span class="keyword">template</span> &lt;<span class="keyword">typename</span> T&gt; <span class="keyword">inline</span> T <a class="code" href="group__math.html#gaed7c12b9ab92540d789a1a4322bafff3" title="Vector dot-product.">dot</a>(<a class="code" href="struct_sifteo_1_1_vector2.html" title="Generalized two-element cartesian coordinate vector.">Vector2&lt;T&gt;</a> u, <a class="code" href="struct_sifteo_1_1_vector2.html" title="Generalized two-element cartesian coordinate vector.">Vector2&lt;T&gt;</a> v) {</div>
<div class="line"><a name="l00646"></a><span class="lineno">  646</span>&#160;    <span class="keywordflow">return</span> u.<a class="code" href="struct_sifteo_1_1_vector2.html#a7362956454caca88012382934a1e94b9" title="Vector component X.">x</a> * v.<a class="code" href="struct_sifteo_1_1_vector2.html#a7362956454caca88012382934a1e94b9" title="Vector component X.">x</a> + u.<a class="code" href="struct_sifteo_1_1_vector2.html#a6ef946409dc8f1fb0fb21f158ad12bec" title="Vector component Y.">y</a> * v.<a class="code" href="struct_sifteo_1_1_vector2.html#a6ef946409dc8f1fb0fb21f158ad12bec" title="Vector component Y.">y</a>;</div>
<div class="line"><a name="l00647"></a><span class="lineno">  647</span>&#160;}</div>
<div class="line"><a name="l00648"></a><span class="lineno">  648</span>&#160;</div>
<div class="line"><a name="l00650"></a><span class="lineno"><a class="code" href="group__math.html#gae1448adbca0e66236057dbc99663a9b3">  650</a></span>&#160;<span class="keyword">template</span> &lt;<span class="keyword">typename</span> T&gt; <span class="keyword">inline</span> <a class="code" href="struct_sifteo_1_1_vector2.html" title="Generalized two-element cartesian coordinate vector.">Vector2&lt;T&gt;</a> <a class="code" href="group__math.html#gae1448adbca0e66236057dbc99663a9b3" title="Convert polar to cartesian.">polar</a>(T angle, T magnitude) {</div>
<div class="line"><a name="l00651"></a><span class="lineno">  651</span>&#160;    <a class="code" href="struct_sifteo_1_1_vector2.html" title="Generalized two-element cartesian coordinate vector.">Vector2&lt;T&gt;</a> result;</div>
<div class="line"><a name="l00652"></a><span class="lineno">  652</span>&#160;    result.<a class="code" href="struct_sifteo_1_1_vector2.html#abe1eadf7f2797aaaa8050f79713a54ff" title="Set this vector to a new cartesian value, given a value in polar coordinates.">setPolar</a>(angle, magnitude);</div>
<div class="line"><a name="l00653"></a><span class="lineno">  653</span>&#160;    <span class="keywordflow">return</span> result;</div>
<div class="line"><a name="l00654"></a><span class="lineno">  654</span>&#160;}</div>
<div class="line"><a name="l00655"></a><span class="lineno">  655</span>&#160;</div>
<div class="line"><a name="l00656"></a><span class="lineno">  656</span>&#160;<span class="comment">// Vector operations</span></div>
<div class="line"><a name="l00657"></a><span class="lineno">  657</span>&#160;<span class="keyword">template</span> &lt;<span class="keyword">typename</span> T&gt; <span class="keyword">inline</span> Vector2&lt;T&gt; operator-(Vector2&lt;T&gt; u) { <span class="keywordflow">return</span> vec&lt;T&gt;(-u.x, -u.y); }</div>
<div class="line"><a name="l00658"></a><span class="lineno">  658</span>&#160;<span class="keyword">template</span> &lt;<span class="keyword">typename</span> T&gt; <span class="keyword">inline</span> Vector2&lt;T&gt; operator+=(Vector2&lt;T&gt; &amp;u, Vector2&lt;T&gt; v) { <span class="keywordflow">return</span> vec&lt;T&gt;(u.x+=v.x, u.y+=v.y); }</div>
<div class="line"><a name="l00659"></a><span class="lineno">  659</span>&#160;<span class="keyword">template</span> &lt;<span class="keyword">typename</span> T&gt; <span class="keyword">inline</span> Vector2&lt;T&gt; operator-=(Vector2&lt;T&gt; &amp;u, Vector2&lt;T&gt; v) { <span class="keywordflow">return</span> vec&lt;T&gt;(u.x-=v.x, u.y-=v.y); }</div>
<div class="line"><a name="l00660"></a><span class="lineno">  660</span>&#160;<span class="keyword">template</span> &lt;<span class="keyword">typename</span> T&gt; <span class="keyword">inline</span> Vector2&lt;T&gt; operator+(Vector2&lt;T&gt; u, Vector2&lt;T&gt; v) { <span class="keywordflow">return</span> vec&lt;T&gt;(u.x+v.x, u.y+v.y); }</div>
<div class="line"><a name="l00661"></a><span class="lineno">  661</span>&#160;<span class="keyword">template</span> &lt;<span class="keyword">typename</span> T&gt; <span class="keyword">inline</span> Vector2&lt;T&gt; operator-(Vector2&lt;T&gt; u, Vector2&lt;T&gt; v) { <span class="keywordflow">return</span> vec&lt;T&gt;(u.x-v.x, u.y-v.y); }</div>
<div class="line"><a name="l00662"></a><span class="lineno">  662</span>&#160;<span class="keyword">template</span> &lt;<span class="keyword">typename</span> T&gt; <span class="keyword">inline</span> Vector2&lt;T&gt; operator*(Vector2&lt;T&gt; u, Vector2&lt;T&gt; v) { <span class="keywordflow">return</span> vec&lt;T&gt;(u.x*v.x, u.y*v.y); }</div>
<div class="line"><a name="l00663"></a><span class="lineno">  663</span>&#160;<span class="keyword">template</span> &lt;<span class="keyword">typename</span> T&gt; <span class="keyword">inline</span> <span class="keywordtype">bool</span> operator==(Vector2&lt;T&gt; u, Vector2&lt;T&gt; v) { <span class="keywordflow">return</span> u.x == v.x &amp;&amp; u.y == v.y; }</div>
<div class="line"><a name="l00664"></a><span class="lineno">  664</span>&#160;<span class="keyword">template</span> &lt;<span class="keyword">typename</span> T&gt; <span class="keyword">inline</span> <span class="keywordtype">bool</span> operator!=(Vector2&lt;T&gt; u, Vector2&lt;T&gt; v) { <span class="keywordflow">return</span> u.x != v.x || u.y != v.y; }</div>
<div class="line"><a name="l00665"></a><span class="lineno">  665</span>&#160;</div>
<div class="line"><a name="l00666"></a><span class="lineno">  666</span>&#160;<span class="comment">// Scalar int promotion</span></div>
<div class="line"><a name="l00667"></a><span class="lineno">  667</span>&#160;<span class="keyword">template</span> &lt;<span class="keyword">typename</span> T&gt; <span class="keyword">inline</span> <a class="code" href="group__math.html#ga4aa5e1c76d3adebd72a73a7051ad1fe0" title="Typedef for a 2-vector of ints.">Int2</a> operator*(<span class="keywordtype">int</span> k, Vector2&lt;T&gt; v) { <span class="keywordflow">return</span> vec&lt;int&gt;(k*v.x, k*v.y); }</div>
<div class="line"><a name="l00668"></a><span class="lineno">  668</span>&#160;<span class="keyword">template</span> &lt;<span class="keyword">typename</span> T&gt; <span class="keyword">inline</span> <a class="code" href="group__math.html#ga4aa5e1c76d3adebd72a73a7051ad1fe0" title="Typedef for a 2-vector of ints.">Int2</a> operator*(Vector2&lt;T&gt; v, <span class="keywordtype">int</span> k) { <span class="keywordflow">return</span> vec&lt;int&gt;(k*v.x, k*v.y); }</div>
<div class="line"><a name="l00669"></a><span class="lineno">  669</span>&#160;<span class="keyword">template</span> &lt;<span class="keyword">typename</span> T&gt; <span class="keyword">inline</span> <a class="code" href="group__math.html#ga4aa5e1c76d3adebd72a73a7051ad1fe0" title="Typedef for a 2-vector of ints.">Int2</a> operator/(Vector2&lt;T&gt; v, <span class="keywordtype">int</span> k) { <span class="keywordflow">return</span> vec&lt;int&gt;(v.x/k, v.y/k); }</div>
<div class="line"><a name="l00670"></a><span class="lineno">  670</span>&#160;<span class="keyword">template</span> &lt;<span class="keyword">typename</span> T&gt; <span class="keyword">inline</span> <a class="code" href="group__math.html#ga4aa5e1c76d3adebd72a73a7051ad1fe0" title="Typedef for a 2-vector of ints.">Int2</a> operator+=(Vector2&lt;T&gt; &amp;u, <span class="keywordtype">int</span> k) { <span class="keywordflow">return</span> vec&lt;int&gt;(u.x+=k, u.y+=k); }</div>
<div class="line"><a name="l00671"></a><span class="lineno">  671</span>&#160;<span class="keyword">template</span> &lt;<span class="keyword">typename</span> T&gt; <span class="keyword">inline</span> <a class="code" href="group__math.html#ga4aa5e1c76d3adebd72a73a7051ad1fe0" title="Typedef for a 2-vector of ints.">Int2</a> operator*=(Vector2&lt;T&gt; &amp;u, <span class="keywordtype">int</span> k) { <span class="keywordflow">return</span> vec&lt;int&gt;(u.x*=k, u.y*=k); }</div>
<div class="line"><a name="l00672"></a><span class="lineno">  672</span>&#160;<span class="keyword">template</span> &lt;<span class="keyword">typename</span> T&gt; <span class="keyword">inline</span> <a class="code" href="group__math.html#ga4aa5e1c76d3adebd72a73a7051ad1fe0" title="Typedef for a 2-vector of ints.">Int2</a> operator&lt;&lt;(Vector2&lt;T&gt; u, <span class="keywordtype">int</span> shift) { <span class="keywordflow">return</span> vec&lt;int&gt;(u.x&lt;&lt;shift, u.y&lt;&lt;shift); }</div>
<div class="line"><a name="l00673"></a><span class="lineno">  673</span>&#160;<span class="keyword">template</span> &lt;<span class="keyword">typename</span> T&gt; <span class="keyword">inline</span> <a class="code" href="group__math.html#ga4aa5e1c76d3adebd72a73a7051ad1fe0" title="Typedef for a 2-vector of ints.">Int2</a> operator&gt;&gt;(Vector2&lt;T&gt; u, <span class="keywordtype">int</span> shift) { <span class="keywordflow">return</span> vec&lt;int&gt;(u.x&gt;&gt;shift, u.y&gt;&gt;shift); }</div>
<div class="line"><a name="l00674"></a><span class="lineno">  674</span>&#160;</div>
<div class="line"><a name="l00675"></a><span class="lineno">  675</span>&#160;<span class="comment">// Scalar float promotion</span></div>
<div class="line"><a name="l00676"></a><span class="lineno">  676</span>&#160;<span class="keyword">template</span> &lt;<span class="keyword">typename</span> T&gt; <span class="keyword">inline</span> <a class="code" href="group__math.html#ga142c5de33f25b2f04428b16b309c9765" title="Typedef for a 2-vector of floats.">Float2</a> operator*(<span class="keywordtype">float</span> k, Vector2&lt;T&gt; v) { <span class="keywordflow">return</span> vec&lt;float&gt;(k*v.x, k*v.y); }</div>
<div class="line"><a name="l00677"></a><span class="lineno">  677</span>&#160;<span class="keyword">template</span> &lt;<span class="keyword">typename</span> T&gt; <span class="keyword">inline</span> <a class="code" href="group__math.html#ga142c5de33f25b2f04428b16b309c9765" title="Typedef for a 2-vector of floats.">Float2</a> operator*(Vector2&lt;T&gt; v, <span class="keywordtype">float</span> k) { <span class="keywordflow">return</span> vec&lt;float&gt;(k*v.x, k*v.y); }</div>
<div class="line"><a name="l00678"></a><span class="lineno">  678</span>&#160;<span class="keyword">template</span> &lt;<span class="keyword">typename</span> T&gt; <span class="keyword">inline</span> <a class="code" href="group__math.html#ga142c5de33f25b2f04428b16b309c9765" title="Typedef for a 2-vector of floats.">Float2</a> operator/(Vector2&lt;T&gt; v, <span class="keywordtype">float</span> k) { <span class="keywordflow">return</span> vec&lt;float&gt;(v.x/k, v.y/k); }</div>
<div class="line"><a name="l00679"></a><span class="lineno">  679</span>&#160;<span class="keyword">template</span> &lt;<span class="keyword">typename</span> T&gt; <span class="keyword">inline</span> <a class="code" href="group__math.html#ga142c5de33f25b2f04428b16b309c9765" title="Typedef for a 2-vector of floats.">Float2</a> operator+=(Vector2&lt;T&gt; &amp;u, <span class="keywordtype">float</span> k) { <span class="keywordflow">return</span> vec&lt;float&gt;(u.x+=k, u.y+=k); }</div>
<div class="line"><a name="l00680"></a><span class="lineno">  680</span>&#160;<span class="keyword">template</span> &lt;<span class="keyword">typename</span> T&gt; <span class="keyword">inline</span> <a class="code" href="group__math.html#ga142c5de33f25b2f04428b16b309c9765" title="Typedef for a 2-vector of floats.">Float2</a> operator*=(Vector2&lt;T&gt; &amp;u, <span class="keywordtype">float</span> k) { <span class="keywordflow">return</span> vec&lt;float&gt;(u.x*=k, u.y*=k); }</div>
<div class="line"><a name="l00681"></a><span class="lineno">  681</span>&#160;</div>
<div class="line"><a name="l00682"></a><span class="lineno">  682</span>&#160;<span class="comment">// Scalar double promotion</span></div>
<div class="line"><a name="l00683"></a><span class="lineno">  683</span>&#160;<span class="keyword">template</span> &lt;<span class="keyword">typename</span> T&gt; <span class="keyword">inline</span> <a class="code" href="group__math.html#ga2de6d1897dbf008f866b526a08c3707f" title="Typedef for a 2-vector of double-precision floats.">Double2</a> operator*(<span class="keywordtype">double</span> k, Vector2&lt;T&gt; v) { <span class="keywordflow">return</span> vec&lt;double&gt;(k*v.x, k*v.y); }</div>
<div class="line"><a name="l00684"></a><span class="lineno">  684</span>&#160;<span class="keyword">template</span> &lt;<span class="keyword">typename</span> T&gt; <span class="keyword">inline</span> <a class="code" href="group__math.html#ga2de6d1897dbf008f866b526a08c3707f" title="Typedef for a 2-vector of double-precision floats.">Double2</a> operator*(Vector2&lt;T&gt; v, <span class="keywordtype">double</span> k) { <span class="keywordflow">return</span> vec&lt;double&gt;(k*v.x, k*v.y); }</div>
<div class="line"><a name="l00685"></a><span class="lineno">  685</span>&#160;<span class="keyword">template</span> &lt;<span class="keyword">typename</span> T&gt; <span class="keyword">inline</span> <a class="code" href="group__math.html#ga2de6d1897dbf008f866b526a08c3707f" title="Typedef for a 2-vector of double-precision floats.">Double2</a> operator/(Vector2&lt;T&gt; v, <span class="keywordtype">double</span> k) { <span class="keywordflow">return</span> vec&lt;double&gt;(v.x/k, v.y/k); }</div>
<div class="line"><a name="l00686"></a><span class="lineno">  686</span>&#160;<span class="keyword">template</span> &lt;<span class="keyword">typename</span> T&gt; <span class="keyword">inline</span> <a class="code" href="group__math.html#ga2de6d1897dbf008f866b526a08c3707f" title="Typedef for a 2-vector of double-precision floats.">Double2</a> operator+=(Vector2&lt;T&gt; &amp;u, <span class="keywordtype">double</span> k) { <span class="keywordflow">return</span> vec&lt;double&gt;(u.x+=k, u.y+=k); }</div>
<div class="line"><a name="l00687"></a><span class="lineno">  687</span>&#160;<span class="keyword">template</span> &lt;<span class="keyword">typename</span> T&gt; <span class="keyword">inline</span> <a class="code" href="group__math.html#ga2de6d1897dbf008f866b526a08c3707f" title="Typedef for a 2-vector of double-precision floats.">Double2</a> operator*=(Vector2&lt;T&gt; &amp;u, <span class="keywordtype">double</span> k) { <span class="keywordflow">return</span> vec&lt;double&gt;(u.x*=k, u.y*=k); }</div>
<div class="line"><a name="l00688"></a><span class="lineno">  688</span>&#160;</div>
<div class="line"><a name="l00689"></a><span class="lineno">  689</span>&#160;<span class="comment">// Vector int -&gt; float promotion</span></div>
<div class="line"><a name="l00690"></a><span class="lineno">  690</span>&#160;<span class="keyword">inline</span> Vector2&lt;float&gt; operator+=(Vector2&lt;float&gt; &amp;u, <a class="code" href="group__math.html#ga4aa5e1c76d3adebd72a73a7051ad1fe0" title="Typedef for a 2-vector of ints.">Int2</a> v) { <span class="keywordflow">return</span> <a class="code" href="group__math.html#gab18c9af04a4a3a4a3c63656e40ab74ed" title="Create a Vector2, from a set of (x,y) coordinates.">vec</a>(u.x+=v.x, u.y+=v.y); }</div>
<div class="line"><a name="l00691"></a><span class="lineno">  691</span>&#160;<span class="keyword">inline</span> Vector2&lt;float&gt; operator-=(Vector2&lt;float&gt; &amp;u, <a class="code" href="group__math.html#ga4aa5e1c76d3adebd72a73a7051ad1fe0" title="Typedef for a 2-vector of ints.">Int2</a> v) { <span class="keywordflow">return</span> <a class="code" href="group__math.html#gab18c9af04a4a3a4a3c63656e40ab74ed" title="Create a Vector2, from a set of (x,y) coordinates.">vec</a>(u.x-=v.x, u.y-=v.y); }</div>
<div class="line"><a name="l00692"></a><span class="lineno">  692</span>&#160;<span class="keyword">inline</span> Vector2&lt;float&gt; operator+(Vector2&lt;float&gt; u, <a class="code" href="group__math.html#ga4aa5e1c76d3adebd72a73a7051ad1fe0" title="Typedef for a 2-vector of ints.">Int2</a> v) { <span class="keywordflow">return</span> <a class="code" href="group__math.html#gab18c9af04a4a3a4a3c63656e40ab74ed" title="Create a Vector2, from a set of (x,y) coordinates.">vec</a>(u.x+v.x, u.y+v.y); }</div>
<div class="line"><a name="l00693"></a><span class="lineno">  693</span>&#160;<span class="keyword">inline</span> Vector2&lt;float&gt; operator-(Vector2&lt;float&gt; u, <a class="code" href="group__math.html#ga4aa5e1c76d3adebd72a73a7051ad1fe0" title="Typedef for a 2-vector of ints.">Int2</a> v) { <span class="keywordflow">return</span> <a class="code" href="group__math.html#gab18c9af04a4a3a4a3c63656e40ab74ed" title="Create a Vector2, from a set of (x,y) coordinates.">vec</a>(u.x-v.x, u.y-v.y); }</div>
<div class="line"><a name="l00694"></a><span class="lineno">  694</span>&#160;<span class="keyword">inline</span> Vector2&lt;float&gt; operator*(Vector2&lt;float&gt; u, <a class="code" href="group__math.html#ga4aa5e1c76d3adebd72a73a7051ad1fe0" title="Typedef for a 2-vector of ints.">Int2</a> v) { <span class="keywordflow">return</span> <a class="code" href="group__math.html#gab18c9af04a4a3a4a3c63656e40ab74ed" title="Create a Vector2, from a set of (x,y) coordinates.">vec</a>(u.x*v.x, u.y*v.y); }</div>
<div class="line"><a name="l00695"></a><span class="lineno">  695</span>&#160;<span class="keyword">inline</span> Vector2&lt;float&gt; operator+(<a class="code" href="group__math.html#ga4aa5e1c76d3adebd72a73a7051ad1fe0" title="Typedef for a 2-vector of ints.">Int2</a> u, Vector2&lt;float&gt; v) { <span class="keywordflow">return</span> <a class="code" href="group__math.html#gab18c9af04a4a3a4a3c63656e40ab74ed" title="Create a Vector2, from a set of (x,y) coordinates.">vec</a>(u.x+v.x, u.y+v.y); }</div>
<div class="line"><a name="l00696"></a><span class="lineno">  696</span>&#160;<span class="keyword">inline</span> Vector2&lt;float&gt; operator-(<a class="code" href="group__math.html#ga4aa5e1c76d3adebd72a73a7051ad1fe0" title="Typedef for a 2-vector of ints.">Int2</a> u, Vector2&lt;float&gt; v) { <span class="keywordflow">return</span> <a class="code" href="group__math.html#gab18c9af04a4a3a4a3c63656e40ab74ed" title="Create a Vector2, from a set of (x,y) coordinates.">vec</a>(u.x-v.x, u.y-v.y); }</div>
<div class="line"><a name="l00697"></a><span class="lineno">  697</span>&#160;<span class="keyword">inline</span> Vector2&lt;float&gt; operator*(<a class="code" href="group__math.html#ga4aa5e1c76d3adebd72a73a7051ad1fe0" title="Typedef for a 2-vector of ints.">Int2</a> u, Vector2&lt;float&gt; v) { <span class="keywordflow">return</span> <a class="code" href="group__math.html#gab18c9af04a4a3a4a3c63656e40ab74ed" title="Create a Vector2, from a set of (x,y) coordinates.">vec</a>(u.x*v.x, u.y*v.y); }</div>
<div class="line"><a name="l00698"></a><span class="lineno">  698</span>&#160;</div>
<div class="line"><a name="l00699"></a><span class="lineno">  699</span>&#160;</div>
<div class="line"><a name="l00704"></a><span class="lineno"><a class="code" href="struct_sifteo_1_1_vector3.html">  704</a></span>&#160;<span class="keyword">template</span> &lt;<span class="keyword">typename</span> T&gt; <span class="keyword">struct </span><a class="code" href="struct_sifteo_1_1_vector3.html" title="Generalized three-element cartesian coordinate vector.">Vector3</a> {</div>
<div class="line"><a name="l00705"></a><span class="lineno"><a class="code" href="struct_sifteo_1_1_vector3.html#a6c4779d36db81b32e49ffcdb5422aeff">  705</a></span>&#160;    T <a class="code" href="struct_sifteo_1_1_vector3.html#a6c4779d36db81b32e49ffcdb5422aeff" title="Vector component X.">x</a>;    </div>
<div class="line"><a name="l00706"></a><span class="lineno"><a class="code" href="struct_sifteo_1_1_vector3.html#aa6028126a108ed37e459d6e78e6e1cbc">  706</a></span>&#160;    T <a class="code" href="struct_sifteo_1_1_vector3.html#aa6028126a108ed37e459d6e78e6e1cbc" title="Vector component Y.">y</a>;    </div>
<div class="line"><a name="l00707"></a><span class="lineno"><a class="code" href="struct_sifteo_1_1_vector3.html#a5d21de12fde3b017fe31240fa53e8748">  707</a></span>&#160;    T <a class="code" href="struct_sifteo_1_1_vector3.html#a5d21de12fde3b017fe31240fa53e8748" title="Vector component Z.">z</a>;    </div>
<div class="line"><a name="l00708"></a><span class="lineno">  708</span>&#160;</div>
<div class="line"><a name="l00710"></a><span class="lineno"><a class="code" href="struct_sifteo_1_1_vector3.html#a0ddc7d6b2c1adb0181f6df3a81ab95ec">  710</a></span>&#160;    <span class="keywordtype">void</span> <span class="keyword">set</span>(T _x, T _y, T _z) {</div>
<div class="line"><a name="l00711"></a><span class="lineno">  711</span>&#160;        <a class="code" href="struct_sifteo_1_1_vector3.html#a6c4779d36db81b32e49ffcdb5422aeff" title="Vector component X.">x</a> = _x;</div>
<div class="line"><a name="l00712"></a><span class="lineno">  712</span>&#160;        <a class="code" href="struct_sifteo_1_1_vector3.html#aa6028126a108ed37e459d6e78e6e1cbc" title="Vector component Y.">y</a> = _y;</div>
<div class="line"><a name="l00713"></a><span class="lineno">  713</span>&#160;        <a class="code" href="struct_sifteo_1_1_vector3.html#a5d21de12fde3b017fe31240fa53e8748" title="Vector component Z.">z</a> = _z;</div>
<div class="line"><a name="l00714"></a><span class="lineno">  714</span>&#160;    }</div>
<div class="line"><a name="l00715"></a><span class="lineno">  715</span>&#160;    </div>
<div class="line"><a name="l00716"></a><span class="lineno"><a class="code" href="struct_sifteo_1_1_vector3.html#af695f5b514c69a24edb57151a31c5210">  716</a></span>&#160;    <a class="code" href="struct_sifteo_1_1_vector2.html" title="Generalized two-element cartesian coordinate vector.">Vector2&lt;T&gt;</a> <a class="code" href="struct_sifteo_1_1_vector3.html#af695f5b514c69a24edb57151a31c5210" title="Extract a 2-vector with only the XY components.">xy</a>()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> <a class="code" href="group__math.html#gab18c9af04a4a3a4a3c63656e40ab74ed" title="Create a Vector2, from a set of (x,y) coordinates.">vec</a>(<a class="code" href="struct_sifteo_1_1_vector3.html#a6c4779d36db81b32e49ffcdb5422aeff" title="Vector component X.">x</a>, <a class="code" href="struct_sifteo_1_1_vector3.html#aa6028126a108ed37e459d6e78e6e1cbc" title="Vector component Y.">y</a>); } </div>
<div class="line"><a name="l00717"></a><span class="lineno"><a class="code" href="struct_sifteo_1_1_vector3.html#a9b44529f8114b80fb06361c61af5cbff">  717</a></span>&#160;    <a class="code" href="struct_sifteo_1_1_vector2.html" title="Generalized two-element cartesian coordinate vector.">Vector2&lt;T&gt;</a> <a class="code" href="struct_sifteo_1_1_vector3.html#a9b44529f8114b80fb06361c61af5cbff" title="Extract a 2-vector with only the XZ components.">xz</a>()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> <a class="code" href="group__math.html#gab18c9af04a4a3a4a3c63656e40ab74ed" title="Create a Vector2, from a set of (x,y) coordinates.">vec</a>(<a class="code" href="struct_sifteo_1_1_vector3.html#a6c4779d36db81b32e49ffcdb5422aeff" title="Vector component X.">x</a>, <a class="code" href="struct_sifteo_1_1_vector3.html#a5d21de12fde3b017fe31240fa53e8748" title="Vector component Z.">z</a>); } </div>
<div class="line"><a name="l00718"></a><span class="lineno"><a class="code" href="struct_sifteo_1_1_vector3.html#a1cf65967396cd0c856a7b4e7f0862aea">  718</a></span>&#160;    <a class="code" href="struct_sifteo_1_1_vector2.html" title="Generalized two-element cartesian coordinate vector.">Vector2&lt;T&gt;</a> <a class="code" href="struct_sifteo_1_1_vector3.html#a1cf65967396cd0c856a7b4e7f0862aea" title="Extract a 2-vector with only the YX components.">yx</a>()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> <a class="code" href="group__math.html#gab18c9af04a4a3a4a3c63656e40ab74ed" title="Create a Vector2, from a set of (x,y) coordinates.">vec</a>(<a class="code" href="struct_sifteo_1_1_vector3.html#aa6028126a108ed37e459d6e78e6e1cbc" title="Vector component Y.">y</a>, <a class="code" href="struct_sifteo_1_1_vector3.html#a6c4779d36db81b32e49ffcdb5422aeff" title="Vector component X.">x</a>); } </div>
<div class="line"><a name="l00719"></a><span class="lineno"><a class="code" href="struct_sifteo_1_1_vector3.html#a09fb0d22cfbab19712f5c3aecb3d970d">  719</a></span>&#160;    <a class="code" href="struct_sifteo_1_1_vector2.html" title="Generalized two-element cartesian coordinate vector.">Vector2&lt;T&gt;</a> <a class="code" href="struct_sifteo_1_1_vector3.html#a09fb0d22cfbab19712f5c3aecb3d970d" title="Extract a 2-vector with only the YZ components.">yz</a>()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> <a class="code" href="group__math.html#gab18c9af04a4a3a4a3c63656e40ab74ed" title="Create a Vector2, from a set of (x,y) coordinates.">vec</a>(<a class="code" href="struct_sifteo_1_1_vector3.html#aa6028126a108ed37e459d6e78e6e1cbc" title="Vector component Y.">y</a>, <a class="code" href="struct_sifteo_1_1_vector3.html#a5d21de12fde3b017fe31240fa53e8748" title="Vector component Z.">z</a>); } </div>
<div class="line"><a name="l00720"></a><span class="lineno"><a class="code" href="struct_sifteo_1_1_vector3.html#a319ba5cd9b3067c2e2d48adc79e16df0">  720</a></span>&#160;    <a class="code" href="struct_sifteo_1_1_vector2.html" title="Generalized two-element cartesian coordinate vector.">Vector2&lt;T&gt;</a> <a class="code" href="struct_sifteo_1_1_vector3.html#a319ba5cd9b3067c2e2d48adc79e16df0" title="Extract a 2-vector with only the ZX components.">zx</a>()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> <a class="code" href="group__math.html#gab18c9af04a4a3a4a3c63656e40ab74ed" title="Create a Vector2, from a set of (x,y) coordinates.">vec</a>(<a class="code" href="struct_sifteo_1_1_vector3.html#a5d21de12fde3b017fe31240fa53e8748" title="Vector component Z.">z</a>, <a class="code" href="struct_sifteo_1_1_vector3.html#a6c4779d36db81b32e49ffcdb5422aeff" title="Vector component X.">x</a>); } </div>
<div class="line"><a name="l00721"></a><span class="lineno"><a class="code" href="struct_sifteo_1_1_vector3.html#a7b13fae9e02f9a223156e174f20c5648">  721</a></span>&#160;    <a class="code" href="struct_sifteo_1_1_vector2.html" title="Generalized two-element cartesian coordinate vector.">Vector2&lt;T&gt;</a> <a class="code" href="struct_sifteo_1_1_vector3.html#a7b13fae9e02f9a223156e174f20c5648" title="Extract a 2-vector with only the ZY components.">zy</a>()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> <a class="code" href="group__math.html#gab18c9af04a4a3a4a3c63656e40ab74ed" title="Create a Vector2, from a set of (x,y) coordinates.">vec</a>(<a class="code" href="struct_sifteo_1_1_vector3.html#a5d21de12fde3b017fe31240fa53e8748" title="Vector component Z.">z</a>, <a class="code" href="struct_sifteo_1_1_vector3.html#aa6028126a108ed37e459d6e78e6e1cbc" title="Vector component Y.">y</a>); } </div>
<div class="line"><a name="l00722"></a><span class="lineno">  722</span>&#160;</div>
<div class="line"><a name="l00728"></a><span class="lineno"><a class="code" href="struct_sifteo_1_1_vector3.html#a63dd922316fbbb2b05ee7179f9de5ea6">  728</a></span>&#160;    T <a class="code" href="struct_sifteo_1_1_vector3.html#a63dd922316fbbb2b05ee7179f9de5ea6" title="Calculate the scalar length (magnitude) of this vector, squared.">len2</a>()<span class="keyword"> const </span>{</div>
<div class="line"><a name="l00729"></a><span class="lineno">  729</span>&#160;        <span class="keywordflow">return</span> ( <a class="code" href="struct_sifteo_1_1_vector3.html#a6c4779d36db81b32e49ffcdb5422aeff" title="Vector component X.">x</a> * <a class="code" href="struct_sifteo_1_1_vector3.html#a6c4779d36db81b32e49ffcdb5422aeff" title="Vector component X.">x</a> + <a class="code" href="struct_sifteo_1_1_vector3.html#aa6028126a108ed37e459d6e78e6e1cbc" title="Vector component Y.">y</a> * <a class="code" href="struct_sifteo_1_1_vector3.html#aa6028126a108ed37e459d6e78e6e1cbc" title="Vector component Y.">y</a> + <a class="code" href="struct_sifteo_1_1_vector3.html#a5d21de12fde3b017fe31240fa53e8748" title="Vector component Z.">z</a> * <a class="code" href="struct_sifteo_1_1_vector3.html#a5d21de12fde3b017fe31240fa53e8748" title="Vector component Z.">z</a> );</div>
<div class="line"><a name="l00730"></a><span class="lineno">  730</span>&#160;    }</div>
<div class="line"><a name="l00731"></a><span class="lineno">  731</span>&#160;</div>
<div class="line"><a name="l00735"></a><span class="lineno"><a class="code" href="struct_sifteo_1_1_vector3.html#a183c2dd26e68dfb8888aba99b2832cdd">  735</a></span>&#160;    T <a class="code" href="struct_sifteo_1_1_vector3.html#a183c2dd26e68dfb8888aba99b2832cdd" title="Calculate the scalar length (magnitude) of this vector.">len</a>()<span class="keyword"> const </span>{</div>
<div class="line"><a name="l00736"></a><span class="lineno">  736</span>&#160;        <span class="keywordflow">return</span> <a class="code" href="group__math.html#ga20311b4dc8c3af67579a2517c36e2e4e" title="Compute the square root of a floating point number. Single-precision.">sqrt</a>(<a class="code" href="struct_sifteo_1_1_vector3.html#a63dd922316fbbb2b05ee7179f9de5ea6" title="Calculate the scalar length (magnitude) of this vector, squared.">len2</a>());</div>
<div class="line"><a name="l00737"></a><span class="lineno">  737</span>&#160;    }</div>
<div class="line"><a name="l00738"></a><span class="lineno">  738</span>&#160;</div>
<div class="line"><a name="l00742"></a><span class="lineno"><a class="code" href="struct_sifteo_1_1_vector3.html#a075772243abff9d880cb35445343abed">  742</a></span>&#160;    T <a class="code" href="struct_sifteo_1_1_vector3.html#a075772243abff9d880cb35445343abed" title="Calculate the manhattan (city block) distance of this vector.">lenManhattan</a>()<span class="keyword"> const </span>{</div>
<div class="line"><a name="l00743"></a><span class="lineno">  743</span>&#160;        <span class="keywordflow">return</span> <a class="code" href="group__math.html#gadfdd37c09079cfe60965b09b186a24f0" title="For any type, return the absolute value.">abs</a>(<a class="code" href="struct_sifteo_1_1_vector3.html#a6c4779d36db81b32e49ffcdb5422aeff" title="Vector component X.">x</a>) + <a class="code" href="group__math.html#gadfdd37c09079cfe60965b09b186a24f0" title="For any type, return the absolute value.">abs</a>(<a class="code" href="struct_sifteo_1_1_vector3.html#aa6028126a108ed37e459d6e78e6e1cbc" title="Vector component Y.">y</a>) + <a class="code" href="group__math.html#gadfdd37c09079cfe60965b09b186a24f0" title="For any type, return the absolute value.">abs</a>(<a class="code" href="struct_sifteo_1_1_vector3.html#a5d21de12fde3b017fe31240fa53e8748" title="Vector component Z.">z</a>);</div>
<div class="line"><a name="l00744"></a><span class="lineno">  744</span>&#160;    }</div>
<div class="line"><a name="l00745"></a><span class="lineno">  745</span>&#160;</div>
<div class="line"><a name="l00751"></a><span class="lineno"><a class="code" href="struct_sifteo_1_1_vector3.html#a53013e5f7a831e3f97a8edeb7af837a0">  751</a></span>&#160;    <a class="code" href="struct_sifteo_1_1_vector3.html" title="Generalized three-element cartesian coordinate vector.">Vector3&lt;T&gt;</a> <a class="code" href="struct_sifteo_1_1_vector3.html#a53013e5f7a831e3f97a8edeb7af837a0" title="Return a normalized version of this vector.">normalize</a>()<span class="keyword"> const </span>{</div>
<div class="line"><a name="l00752"></a><span class="lineno">  752</span>&#160;        <span class="keywordflow">return</span> *<span class="keyword">this</span> / <a class="code" href="struct_sifteo_1_1_vector3.html#a183c2dd26e68dfb8888aba99b2832cdd" title="Calculate the scalar length (magnitude) of this vector.">len</a>();</div>
<div class="line"><a name="l00753"></a><span class="lineno">  753</span>&#160;    }</div>
<div class="line"><a name="l00754"></a><span class="lineno">  754</span>&#160;</div>
<div class="line"><a name="l00758"></a><span class="lineno"><a class="code" href="struct_sifteo_1_1_vector3.html#aeebe57bffe3e6acecb479990c482eb92">  758</a></span>&#160;    <a class="code" href="struct_sifteo_1_1_vector3.html" title="Generalized three-element cartesian coordinate vector.">Vector3&lt;int&gt;</a> <a class="code" href="struct_sifteo_1_1_vector3.html#aeebe57bffe3e6acecb479990c482eb92" title="Round a floating point vector to the nearest integer.">round</a>()<span class="keyword"> const </span>{</div>
<div class="line"><a name="l00759"></a><span class="lineno">  759</span>&#160;        <a class="code" href="struct_sifteo_1_1_vector3.html" title="Generalized three-element cartesian coordinate vector.">Vector3&lt;int&gt;</a> result = { <a class="code" href="struct_sifteo_1_1_vector3.html#a6c4779d36db81b32e49ffcdb5422aeff" title="Vector component X.">x</a> + 0.5f, <a class="code" href="struct_sifteo_1_1_vector3.html#aa6028126a108ed37e459d6e78e6e1cbc" title="Vector component Y.">y</a> + 0.5f, <a class="code" href="struct_sifteo_1_1_vector3.html#a5d21de12fde3b017fe31240fa53e8748" title="Vector component Z.">z</a> + 0.5f };</div>
<div class="line"><a name="l00760"></a><span class="lineno">  760</span>&#160;        <span class="keywordflow">return</span> result;</div>
<div class="line"><a name="l00761"></a><span class="lineno">  761</span>&#160;    }</div>
<div class="line"><a name="l00762"></a><span class="lineno">  762</span>&#160;</div>
<div class="line"><a name="l00766"></a><span class="lineno"><a class="code" href="struct_sifteo_1_1_vector3.html#a0dad5235a52474205eb549c58d0cf558">  766</a></span>&#160;    <a class="code" href="struct_sifteo_1_1_vector3.html" title="Generalized three-element cartesian coordinate vector.">Vector3&lt;T&gt;</a> <a class="code" href="struct_sifteo_1_1_vector3.html#a0dad5235a52474205eb549c58d0cf558" title="Rotate the vector about the Z axis counterclockwise by &#39;angle&#39; radians.">zRotate</a>(<span class="keywordtype">float</span> angle)<span class="keyword"> const </span>{</div>
<div class="line"><a name="l00767"></a><span class="lineno">  767</span>&#160;        <span class="keywordtype">float</span> s, c;</div>
<div class="line"><a name="l00768"></a><span class="lineno">  768</span>&#160;        <a class="code" href="group__math.html#ga638c110b2937214ee62cbc7ddabad130" title="Simultaneously compute the sine and cosine of a specified angle, in radians.">sincos</a>(angle, &amp;s, &amp;c);</div>
<div class="line"><a name="l00769"></a><span class="lineno">  769</span>&#160;        <a class="code" href="struct_sifteo_1_1_vector3.html" title="Generalized three-element cartesian coordinate vector.">Vector3&lt;T&gt;</a> result = { <a class="code" href="struct_sifteo_1_1_vector3.html#a6c4779d36db81b32e49ffcdb5422aeff" title="Vector component X.">x</a>*c - <a class="code" href="struct_sifteo_1_1_vector3.html#aa6028126a108ed37e459d6e78e6e1cbc" title="Vector component Y.">y</a>*s, <a class="code" href="struct_sifteo_1_1_vector3.html#a6c4779d36db81b32e49ffcdb5422aeff" title="Vector component X.">x</a>*s + <a class="code" href="struct_sifteo_1_1_vector3.html#aa6028126a108ed37e459d6e78e6e1cbc" title="Vector component Y.">y</a>*c, <a class="code" href="struct_sifteo_1_1_vector3.html#a5d21de12fde3b017fe31240fa53e8748" title="Vector component Z.">z</a> };</div>
<div class="line"><a name="l00770"></a><span class="lineno">  770</span>&#160;        <span class="keywordflow">return</span> result;</div>
<div class="line"><a name="l00771"></a><span class="lineno">  771</span>&#160;    }</div>
<div class="line"><a name="l00772"></a><span class="lineno">  772</span>&#160;</div>
<div class="line"><a name="l00781"></a><span class="lineno"><a class="code" href="struct_sifteo_1_1_vector3.html#a0305e2ccb6c70308d3b5d44dbb27e862">  781</a></span>&#160;    <a class="code" href="struct_sifteo_1_1_vector3.html" title="Generalized three-element cartesian coordinate vector.">Vector3&lt;T&gt;</a> <a class="code" href="struct_sifteo_1_1_vector3.html#a0305e2ccb6c70308d3b5d44dbb27e862" title="Rotate this vector about the Z axis counterclockwise by an integer multiple of 90 degrees...">zRotateI</a>(<span class="keywordtype">int</span> angle)<span class="keyword"> const </span>{</div>
<div class="line"><a name="l00782"></a><span class="lineno">  782</span>&#160;        <a class="code" href="struct_sifteo_1_1_vector3.html" title="Generalized three-element cartesian coordinate vector.">Vector3&lt;T&gt;</a> a1 = { -<a class="code" href="struct_sifteo_1_1_vector3.html#aa6028126a108ed37e459d6e78e6e1cbc" title="Vector component Y.">y</a>,  <a class="code" href="struct_sifteo_1_1_vector3.html#a6c4779d36db81b32e49ffcdb5422aeff" title="Vector component X.">x</a>, <a class="code" href="struct_sifteo_1_1_vector3.html#a5d21de12fde3b017fe31240fa53e8748" title="Vector component Z.">z</a> };</div>
<div class="line"><a name="l00783"></a><span class="lineno">  783</span>&#160;        <a class="code" href="struct_sifteo_1_1_vector3.html" title="Generalized three-element cartesian coordinate vector.">Vector3&lt;T&gt;</a> a2 = { -<a class="code" href="struct_sifteo_1_1_vector3.html#a6c4779d36db81b32e49ffcdb5422aeff" title="Vector component X.">x</a>, -<a class="code" href="struct_sifteo_1_1_vector3.html#aa6028126a108ed37e459d6e78e6e1cbc" title="Vector component Y.">y</a>, <a class="code" href="struct_sifteo_1_1_vector3.html#a5d21de12fde3b017fe31240fa53e8748" title="Vector component Z.">z</a> };</div>
<div class="line"><a name="l00784"></a><span class="lineno">  784</span>&#160;        <a class="code" href="struct_sifteo_1_1_vector3.html" title="Generalized three-element cartesian coordinate vector.">Vector3&lt;T&gt;</a> a3 = {  <a class="code" href="struct_sifteo_1_1_vector3.html#aa6028126a108ed37e459d6e78e6e1cbc" title="Vector component Y.">y</a>, -<a class="code" href="struct_sifteo_1_1_vector3.html#a6c4779d36db81b32e49ffcdb5422aeff" title="Vector component X.">x</a>, <a class="code" href="struct_sifteo_1_1_vector3.html#a5d21de12fde3b017fe31240fa53e8748" title="Vector component Z.">z</a> };</div>
<div class="line"><a name="l00785"></a><span class="lineno">  785</span>&#160;        <span class="keywordflow">switch</span> (angle) {</div>
<div class="line"><a name="l00786"></a><span class="lineno">  786</span>&#160;            <span class="keywordflow">default</span>: <a class="code" href="group__macros.html#ga8a15779356736a0900a162442b1cda53" title="Runtime debug assertion.">ASSERT</a>(0);</div>
<div class="line"><a name="l00787"></a><span class="lineno">  787</span>&#160;            <span class="keywordflow">case</span> 0: <span class="keywordflow">return</span> *<span class="keyword">this</span>;</div>
<div class="line"><a name="l00788"></a><span class="lineno">  788</span>&#160;            <span class="keywordflow">case</span> 1: <span class="keywordflow">return</span> a1;</div>
<div class="line"><a name="l00789"></a><span class="lineno">  789</span>&#160;            <span class="keywordflow">case</span> 2: <span class="keywordflow">return</span> a2;</div>
<div class="line"><a name="l00790"></a><span class="lineno">  790</span>&#160;            <span class="keywordflow">case</span> 3: <span class="keywordflow">return</span> a3;</div>
<div class="line"><a name="l00791"></a><span class="lineno">  791</span>&#160;        }</div>
<div class="line"><a name="l00792"></a><span class="lineno">  792</span>&#160;    }</div>
<div class="line"><a name="l00793"></a><span class="lineno">  793</span>&#160;</div>
<div class="line"><a name="l00798"></a><span class="lineno"><a class="code" href="struct_sifteo_1_1_vector3.html#a628bb1bf3ed5536f90e1366a886b2581">  798</a></span>&#160;    <span class="keyword">template</span> &lt;<span class="keyword">typename</span> R&gt; <a class="code" href="struct_sifteo_1_1_vector3.html" title="Generalized three-element cartesian coordinate vector.">Vector3&lt;R&gt;</a> <a class="code" href="struct_sifteo_1_1_vector3.html#a628bb1bf3ed5536f90e1366a886b2581" title="Explicitly cast this vector to another vector type, using default C++ truncation or extension rules...">cast</a>()<span class="keyword"> const </span>{</div>
<div class="line"><a name="l00799"></a><span class="lineno">  799</span>&#160;        <a class="code" href="struct_sifteo_1_1_vector3.html" title="Generalized three-element cartesian coordinate vector.">Vector3&lt;R&gt;</a> result = { <a class="code" href="struct_sifteo_1_1_vector3.html#a6c4779d36db81b32e49ffcdb5422aeff" title="Vector component X.">x</a>, <a class="code" href="struct_sifteo_1_1_vector3.html#aa6028126a108ed37e459d6e78e6e1cbc" title="Vector component Y.">y</a>, <a class="code" href="struct_sifteo_1_1_vector3.html#a5d21de12fde3b017fe31240fa53e8748" title="Vector component Z.">z</a> };</div>
<div class="line"><a name="l00800"></a><span class="lineno">  800</span>&#160;        <span class="keywordflow">return</span> result;</div>
<div class="line"><a name="l00801"></a><span class="lineno">  801</span>&#160;    }</div>
<div class="line"><a name="l00802"></a><span class="lineno">  802</span>&#160;    </div>
<div class="line"><a name="l00804"></a><span class="lineno"><a class="code" href="struct_sifteo_1_1_vector3.html#a43c5131396aaa2c184883fe7dce321f7">  804</a></span>&#160;    <a class="code" href="struct_sifteo_1_1_vector3.html" title="Generalized three-element cartesian coordinate vector.">Vector3&lt;int&gt;</a> <a class="code" href="struct_sifteo_1_1_vector3.html#a43c5131396aaa2c184883fe7dce321f7" title="Explicit cast to int.">toInt</a>()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> cast&lt;int&gt;(); }</div>
<div class="line"><a name="l00806"></a><span class="lineno"><a class="code" href="struct_sifteo_1_1_vector3.html#aed1497b11f7c4b6b0ed10f00a52d0a26">  806</a></span>&#160;    <a class="code" href="struct_sifteo_1_1_vector3.html" title="Generalized three-element cartesian coordinate vector.">Vector3&lt;float&gt;</a> <a class="code" href="struct_sifteo_1_1_vector3.html#aed1497b11f7c4b6b0ed10f00a52d0a26" title="Explicit cast to float.">toFloat</a>()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> cast&lt;float&gt;(); }</div>
<div class="line"><a name="l00808"></a><span class="lineno"><a class="code" href="struct_sifteo_1_1_vector3.html#ac5e79583c7527d8226ade9f09d58407d">  808</a></span>&#160;    <a class="code" href="struct_sifteo_1_1_vector3.html" title="Generalized three-element cartesian coordinate vector.">Vector3&lt;double&gt;</a> <a class="code" href="struct_sifteo_1_1_vector3.html#ac5e79583c7527d8226ade9f09d58407d" title="Explicit cast to double.">toDouble</a>()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> cast&lt;double&gt;(); }</div>
<div class="line"><a name="l00809"></a><span class="lineno">  809</span>&#160;    </div>
<div class="line"><a name="l00810"></a><span class="lineno">  810</span>&#160;    <span class="comment">// Implicit casts</span></div>
<div class="line"><a name="l00811"></a><span class="lineno">  811</span>&#160;    <span class="keyword">operator</span> <a class="code" href="struct_sifteo_1_1_vector3.html" title="Generalized three-element cartesian coordinate vector.">Vector3&lt;int&gt;</a>            () <span class="keyword">const</span> { <span class="keywordflow">return</span> cast&lt;int&gt;(); }</div>
<div class="line"><a name="l00812"></a><span class="lineno">  812</span>&#160;    <span class="keyword">operator</span> Vector3&lt;unsigned&gt;       () <span class="keyword">const</span> { <span class="keywordflow">return</span> cast&lt;unsigned&gt;(); }</div>
<div class="line"><a name="l00813"></a><span class="lineno">  813</span>&#160;    <span class="keyword">operator</span> Vector3&lt;short&gt;          () <span class="keyword">const</span> { <span class="keywordflow">return</span> cast&lt;short&gt;(); }</div>
<div class="line"><a name="l00814"></a><span class="lineno">  814</span>&#160;    <span class="keyword">operator</span> Vector3&lt;unsigned short&gt; () <span class="keyword">const</span> { <span class="keywordflow">return</span> cast&lt;unsigned short&gt;(); }</div>
<div class="line"><a name="l00815"></a><span class="lineno">  815</span>&#160;    <span class="keyword">operator</span> Vector3&lt;int8_t&gt;         () <span class="keyword">const</span> { <span class="keywordflow">return</span> cast&lt;int8_t&gt;(); }</div>
<div class="line"><a name="l00816"></a><span class="lineno">  816</span>&#160;    <span class="keyword">operator</span> Vector3&lt;uint8_t&gt;        () <span class="keyword">const</span> { <span class="keywordflow">return</span> cast&lt;uint8_t&gt;(); }</div>
<div class="line"><a name="l00817"></a><span class="lineno">  817</span>&#160;    <span class="keyword">operator</span> Vector3&lt;float&gt;          () <span class="keyword">const</span> { <span class="keywordflow">return</span> cast&lt;float&gt;(); }</div>
<div class="line"><a name="l00818"></a><span class="lineno">  818</span>&#160;    <span class="keyword">operator</span> Vector3&lt;double&gt;         () <span class="keyword">const</span> { <span class="keywordflow">return</span> cast&lt;double&gt;(); }</div>
<div class="line"><a name="l00819"></a><span class="lineno">  819</span>&#160;};</div>
<div class="line"><a name="l00820"></a><span class="lineno">  820</span>&#160;</div>
<div class="line"><a name="l00821"></a><span class="lineno"><a class="code" href="group__math.html#gadf60fc5d5c0643721fc47d903088be0e">  821</a></span>&#160;<span class="keyword">typedef</span> <a class="code" href="struct_sifteo_1_1_vector3.html" title="Generalized three-element cartesian coordinate vector.">Vector3&lt;int&gt;</a>                <a class="code" href="group__math.html#gadf60fc5d5c0643721fc47d903088be0e" title="Typedef for a 2-vector of ints.">Int3</a>;       </div>
<div class="line"><a name="l00822"></a><span class="lineno"><a class="code" href="group__math.html#ga3c88fa6a9f6d33e034025f190109a7b9">  822</a></span>&#160;<span class="keyword">typedef</span> <a class="code" href="struct_sifteo_1_1_vector3.html" title="Generalized three-element cartesian coordinate vector.">Vector3&lt;unsigned&gt;</a>           <a class="code" href="group__math.html#ga3c88fa6a9f6d33e034025f190109a7b9" title="Typedef for a 2-vector of unsigned ints.">UInt3</a>;      </div>
<div class="line"><a name="l00823"></a><span class="lineno"><a class="code" href="group__math.html#gae7f0a2eaa3374dd2b52d2d10d3a123e4">  823</a></span>&#160;<span class="keyword">typedef</span> <a class="code" href="struct_sifteo_1_1_vector3.html" title="Generalized three-element cartesian coordinate vector.">Vector3&lt;short&gt;</a>              <a class="code" href="group__math.html#gae7f0a2eaa3374dd2b52d2d10d3a123e4" title="Typedef for a 2-vector of shorts.">Short3</a>;     </div>
<div class="line"><a name="l00824"></a><span class="lineno"><a class="code" href="group__math.html#ga64804b219b2af4a9e44d38a2e8793503">  824</a></span>&#160;<span class="keyword">typedef</span> <a class="code" href="struct_sifteo_1_1_vector3.html" title="Generalized three-element cartesian coordinate vector.">Vector3&lt;unsigned short&gt;</a>     <a class="code" href="group__math.html#ga64804b219b2af4a9e44d38a2e8793503" title="Typedef for a 2-vector of unsigned shorts.">UShort3</a>;    </div>
<div class="line"><a name="l00825"></a><span class="lineno"><a class="code" href="group__math.html#gaec7afb90b5c1db8751abaf5f0406f6b7">  825</a></span>&#160;<span class="keyword">typedef</span> <a class="code" href="struct_sifteo_1_1_vector3.html">Vector3&lt;int8_t&gt;</a>             <a class="code" href="group__math.html#gaec7afb90b5c1db8751abaf5f0406f6b7" title="Typedef for a 2-vector of bytes.">Byte3</a>;      </div>
<div class="line"><a name="l00826"></a><span class="lineno"><a class="code" href="group__math.html#ga9f905eaec08f79d6c938b70ce4007e53">  826</a></span>&#160;<span class="keyword">typedef</span> <a class="code" href="struct_sifteo_1_1_vector3.html" title="Generalized three-element cartesian coordinate vector.">Vector3&lt;uint8_t&gt;</a>            <a class="code" href="group__math.html#ga9f905eaec08f79d6c938b70ce4007e53" title="Typedef for a 2-vector of unsigned bytes.">UByte3</a>;     </div>
<div class="line"><a name="l00827"></a><span class="lineno"><a class="code" href="group__math.html#ga4c88e729af0eb9bdaeab6845bb685874">  827</a></span>&#160;<span class="keyword">typedef</span> <a class="code" href="struct_sifteo_1_1_vector3.html" title="Generalized three-element cartesian coordinate vector.">Vector3&lt;float&gt;</a>              <a class="code" href="group__math.html#ga4c88e729af0eb9bdaeab6845bb685874" title="Typedef for a 2-vector of floats.">Float3</a>;     </div>
<div class="line"><a name="l00828"></a><span class="lineno"><a class="code" href="group__math.html#ga27a00f39e0d622233fe4eb671d38fa28">  828</a></span>&#160;<span class="keyword">typedef</span> <a class="code" href="struct_sifteo_1_1_vector3.html" title="Generalized three-element cartesian coordinate vector.">Vector3&lt;double&gt;</a>             <a class="code" href="group__math.html#ga27a00f39e0d622233fe4eb671d38fa28" title="Typedef for a 2-vector of double-precision floats.">Double3</a>;    </div>
<div class="line"><a name="l00829"></a><span class="lineno">  829</span>&#160;</div>
<div class="line"><a name="l00838"></a><span class="lineno"><a class="code" href="group__math.html#ga5a82b10ac56daa5121035dbaf1689d3a">  838</a></span>&#160;<span class="keyword">template</span> &lt;<span class="keyword">typename</span> T&gt; <span class="keyword">inline</span> <a class="code" href="struct_sifteo_1_1_vector3.html" title="Generalized three-element cartesian coordinate vector.">Vector3&lt;T&gt;</a> <a class="code" href="group__math.html#gab18c9af04a4a3a4a3c63656e40ab74ed" title="Create a Vector2, from a set of (x,y) coordinates.">vec</a>(T x, T y, T z) {</div>
<div class="line"><a name="l00839"></a><span class="lineno">  839</span>&#160;    <a class="code" href="struct_sifteo_1_1_vector3.html" title="Generalized three-element cartesian coordinate vector.">Vector3&lt;T&gt;</a> result = { x, y, z };</div>
<div class="line"><a name="l00840"></a><span class="lineno">  840</span>&#160;    <span class="keywordflow">return</span> result;</div>
<div class="line"><a name="l00841"></a><span class="lineno">  841</span>&#160;}</div>
<div class="line"><a name="l00842"></a><span class="lineno">  842</span>&#160;</div>
<div class="line"><a name="l00844"></a><span class="lineno"><a class="code" href="group__math.html#ga40f30e4e24c977d91d95d42eb76889f8">  844</a></span>&#160;<span class="keyword">template</span> &lt;<span class="keyword">typename</span> T&gt; <span class="keyword">inline</span> T <a class="code" href="group__math.html#gaed7c12b9ab92540d789a1a4322bafff3" title="Vector dot-product.">dot</a>(<a class="code" href="struct_sifteo_1_1_vector3.html" title="Generalized three-element cartesian coordinate vector.">Vector3&lt;T&gt;</a> u, <a class="code" href="struct_sifteo_1_1_vector3.html" title="Generalized three-element cartesian coordinate vector.">Vector3&lt;T&gt;</a> v) {</div>
<div class="line"><a name="l00845"></a><span class="lineno">  845</span>&#160;    <span class="keywordflow">return</span> u.<a class="code" href="struct_sifteo_1_1_vector3.html#a6c4779d36db81b32e49ffcdb5422aeff" title="Vector component X.">x</a> * v.<a class="code" href="struct_sifteo_1_1_vector3.html#a6c4779d36db81b32e49ffcdb5422aeff" title="Vector component X.">x</a> + u.<a class="code" href="struct_sifteo_1_1_vector3.html#aa6028126a108ed37e459d6e78e6e1cbc" title="Vector component Y.">y</a> * v.<a class="code" href="struct_sifteo_1_1_vector3.html#aa6028126a108ed37e459d6e78e6e1cbc" title="Vector component Y.">y</a> + u.<a class="code" href="struct_sifteo_1_1_vector3.html#a5d21de12fde3b017fe31240fa53e8748" title="Vector component Z.">z</a> * v.<a class="code" href="struct_sifteo_1_1_vector3.html#a5d21de12fde3b017fe31240fa53e8748" title="Vector component Z.">z</a>;</div>
<div class="line"><a name="l00846"></a><span class="lineno">  846</span>&#160;}</div>
<div class="line"><a name="l00847"></a><span class="lineno">  847</span>&#160;</div>
<div class="line"><a name="l00849"></a><span class="lineno"><a class="code" href="group__math.html#ga7eebcc537123b8edf7efd6680bfde64c">  849</a></span>&#160;<span class="keyword">template</span> &lt;<span class="keyword">typename</span> T&gt; <span class="keyword">inline</span> T <a class="code" href="group__math.html#ga7eebcc537123b8edf7efd6680bfde64c" title="Vector cross-product.">cross</a>(T u, T v) {</div>
<div class="line"><a name="l00850"></a><span class="lineno">  850</span>&#160;    <span class="keywordflow">return</span> <a class="code" href="group__math.html#gab18c9af04a4a3a4a3c63656e40ab74ed" title="Create a Vector2, from a set of (x,y) coordinates.">vec</a>(u.y * v.z - u.z * v.y,</div>
<div class="line"><a name="l00851"></a><span class="lineno">  851</span>&#160;               u.z * v.x - u.x * v.z,</div>
<div class="line"><a name="l00852"></a><span class="lineno">  852</span>&#160;               u.x * v.y - u.y * v.x);</div>
<div class="line"><a name="l00853"></a><span class="lineno">  853</span>&#160;}</div>
<div class="line"><a name="l00854"></a><span class="lineno">  854</span>&#160;</div>
<div class="line"><a name="l00855"></a><span class="lineno">  855</span>&#160;<span class="comment">// Vector operations</span></div>
<div class="line"><a name="l00856"></a><span class="lineno">  856</span>&#160;<span class="keyword">template</span> &lt;<span class="keyword">typename</span> T&gt; <span class="keyword">inline</span> Vector3&lt;T&gt; operator-(Vector3&lt;T&gt; u) { <span class="keywordflow">return</span> vec&lt;T&gt;(-u.x, -u.y, -u.z); }</div>
<div class="line"><a name="l00857"></a><span class="lineno">  857</span>&#160;<span class="keyword">template</span> &lt;<span class="keyword">typename</span> T&gt; <span class="keyword">inline</span> Vector3&lt;T&gt; operator+=(Vector3&lt;T&gt; &amp;u, Vector3&lt;T&gt; v) { <span class="keywordflow">return</span> vec&lt;T&gt;(u.x+=v.x, u.y+=v.y, u.z+=v.z); }</div>
<div class="line"><a name="l00858"></a><span class="lineno">  858</span>&#160;<span class="keyword">template</span> &lt;<span class="keyword">typename</span> T&gt; <span class="keyword">inline</span> Vector3&lt;T&gt; operator-=(Vector3&lt;T&gt; &amp;u, Vector3&lt;T&gt; v) { <span class="keywordflow">return</span> vec&lt;T&gt;(u.x-=v.x, u.y-=v.y, u.z-=v.z); }</div>
<div class="line"><a name="l00859"></a><span class="lineno">  859</span>&#160;<span class="keyword">template</span> &lt;<span class="keyword">typename</span> T&gt; <span class="keyword">inline</span> Vector3&lt;T&gt; operator+(Vector3&lt;T&gt; u, Vector3&lt;T&gt; v) { <span class="keywordflow">return</span> vec&lt;T&gt;(u.x+v.x, u.y+v.y, u.z+v.z); }</div>
<div class="line"><a name="l00860"></a><span class="lineno">  860</span>&#160;<span class="keyword">template</span> &lt;<span class="keyword">typename</span> T&gt; <span class="keyword">inline</span> Vector3&lt;T&gt; operator-(Vector3&lt;T&gt; u, Vector3&lt;T&gt; v) { <span class="keywordflow">return</span> vec&lt;T&gt;(u.x-v.x, u.y-v.y, u.z-v.z); }</div>
<div class="line"><a name="l00861"></a><span class="lineno">  861</span>&#160;<span class="keyword">template</span> &lt;<span class="keyword">typename</span> T&gt; <span class="keyword">inline</span> Vector3&lt;T&gt; operator*(Vector3&lt;T&gt; u, Vector3&lt;T&gt; v) { <span class="keywordflow">return</span> vec&lt;T&gt;(u.x*v.x, u.y*v.y, u.z*v.z); }</div>
<div class="line"><a name="l00862"></a><span class="lineno">  862</span>&#160;<span class="keyword">template</span> &lt;<span class="keyword">typename</span> T&gt; <span class="keyword">inline</span> <span class="keywordtype">bool</span> operator==(Vector3&lt;T&gt; u, Vector3&lt;T&gt; v) { <span class="keywordflow">return</span> u.x == v.x &amp;&amp; u.y == v.y &amp;&amp; u.z == v.z; }</div>
<div class="line"><a name="l00863"></a><span class="lineno">  863</span>&#160;<span class="keyword">template</span> &lt;<span class="keyword">typename</span> T&gt; <span class="keyword">inline</span> <span class="keywordtype">bool</span> operator!=(Vector3&lt;T&gt; u, Vector3&lt;T&gt; v) { <span class="keywordflow">return</span> u.x != v.x || u.y != v.y || u.z != v.z; }</div>
<div class="line"><a name="l00864"></a><span class="lineno">  864</span>&#160;</div>
<div class="line"><a name="l00865"></a><span class="lineno">  865</span>&#160;<span class="comment">// Scalar int promotion</span></div>
<div class="line"><a name="l00866"></a><span class="lineno">  866</span>&#160;<span class="keyword">template</span> &lt;<span class="keyword">typename</span> T&gt; <span class="keyword">inline</span> <a class="code" href="group__math.html#gadf60fc5d5c0643721fc47d903088be0e" title="Typedef for a 2-vector of ints.">Int3</a> operator*(<span class="keywordtype">int</span> k, Vector3&lt;T&gt; v) { <span class="keywordflow">return</span> vec&lt;int&gt;(k*v.x, k*v.y, k*v.z); }</div>
<div class="line"><a name="l00867"></a><span class="lineno">  867</span>&#160;<span class="keyword">template</span> &lt;<span class="keyword">typename</span> T&gt; <span class="keyword">inline</span> <a class="code" href="group__math.html#gadf60fc5d5c0643721fc47d903088be0e" title="Typedef for a 2-vector of ints.">Int3</a> operator*(Vector3&lt;T&gt; v, <span class="keywordtype">int</span> k) { <span class="keywordflow">return</span> vec&lt;int&gt;(k*v.x, k*v.y, k*v.z); }</div>
<div class="line"><a name="l00868"></a><span class="lineno">  868</span>&#160;<span class="keyword">template</span> &lt;<span class="keyword">typename</span> T&gt; <span class="keyword">inline</span> <a class="code" href="group__math.html#gadf60fc5d5c0643721fc47d903088be0e" title="Typedef for a 2-vector of ints.">Int3</a> operator/(Vector3&lt;T&gt; v, <span class="keywordtype">int</span> k) { <span class="keywordflow">return</span> vec&lt;int&gt;(v.x/k, v.y/k, v.z/k); }</div>
<div class="line"><a name="l00869"></a><span class="lineno">  869</span>&#160;<span class="keyword">template</span> &lt;<span class="keyword">typename</span> T&gt; <span class="keyword">inline</span> <a class="code" href="group__math.html#gadf60fc5d5c0643721fc47d903088be0e" title="Typedef for a 2-vector of ints.">Int3</a> operator+=(Vector3&lt;T&gt; &amp;u, <span class="keywordtype">int</span> k) { <span class="keywordflow">return</span> vec&lt;int&gt;(u.x+=k, u.y+=k, u.z+=k); }</div>
<div class="line"><a name="l00870"></a><span class="lineno">  870</span>&#160;<span class="keyword">template</span> &lt;<span class="keyword">typename</span> T&gt; <span class="keyword">inline</span> <a class="code" href="group__math.html#gadf60fc5d5c0643721fc47d903088be0e" title="Typedef for a 2-vector of ints.">Int3</a> operator*=(Vector3&lt;T&gt; &amp;u, <span class="keywordtype">int</span> k) { <span class="keywordflow">return</span> vec&lt;int&gt;(u.x*=k, u.y*=k, u.z*=k); }</div>
<div class="line"><a name="l00871"></a><span class="lineno">  871</span>&#160;<span class="keyword">template</span> &lt;<span class="keyword">typename</span> T&gt; <span class="keyword">inline</span> <a class="code" href="group__math.html#gadf60fc5d5c0643721fc47d903088be0e" title="Typedef for a 2-vector of ints.">Int3</a> operator&lt;&lt;(Vector3&lt;T&gt; u, <span class="keywordtype">int</span> shift) { <span class="keywordflow">return</span> vec&lt;int&gt;(u.x&lt;&lt;shift, u.y&lt;&lt;shift, u.z&lt;&lt;shift); }</div>
<div class="line"><a name="l00872"></a><span class="lineno">  872</span>&#160;<span class="keyword">template</span> &lt;<span class="keyword">typename</span> T&gt; <span class="keyword">inline</span> <a class="code" href="group__math.html#gadf60fc5d5c0643721fc47d903088be0e" title="Typedef for a 2-vector of ints.">Int3</a> operator&gt;&gt;(Vector3&lt;T&gt; u, <span class="keywordtype">int</span> shift) { <span class="keywordflow">return</span> vec&lt;int&gt;(u.x&gt;&gt;shift, u.y&gt;&gt;shift, u.z&gt;&gt;shift); }</div>
<div class="line"><a name="l00873"></a><span class="lineno">  873</span>&#160;</div>
<div class="line"><a name="l00874"></a><span class="lineno">  874</span>&#160;<span class="comment">// Scalar float promotion</span></div>
<div class="line"><a name="l00875"></a><span class="lineno">  875</span>&#160;<span class="keyword">template</span> &lt;<span class="keyword">typename</span> T&gt; <span class="keyword">inline</span> <a class="code" href="group__math.html#ga4c88e729af0eb9bdaeab6845bb685874" title="Typedef for a 2-vector of floats.">Float3</a> operator*(<span class="keywordtype">float</span> k, Vector3&lt;T&gt; v) { <span class="keywordflow">return</span> vec&lt;float&gt;(k*v.x, k*v.y, k*v.z); }</div>
<div class="line"><a name="l00876"></a><span class="lineno">  876</span>&#160;<span class="keyword">template</span> &lt;<span class="keyword">typename</span> T&gt; <span class="keyword">inline</span> <a class="code" href="group__math.html#ga4c88e729af0eb9bdaeab6845bb685874" title="Typedef for a 2-vector of floats.">Float3</a> operator*(Vector3&lt;T&gt; v, <span class="keywordtype">float</span> k) { <span class="keywordflow">return</span> vec&lt;float&gt;(k*v.x, k*v.y, k*v.z); }</div>
<div class="line"><a name="l00877"></a><span class="lineno">  877</span>&#160;<span class="keyword">template</span> &lt;<span class="keyword">typename</span> T&gt; <span class="keyword">inline</span> <a class="code" href="group__math.html#ga4c88e729af0eb9bdaeab6845bb685874" title="Typedef for a 2-vector of floats.">Float3</a> operator/(Vector3&lt;T&gt; v, <span class="keywordtype">float</span> k) { <span class="keywordflow">return</span> vec&lt;float&gt;(v.x/k, v.y/k, v.z/k); }</div>
<div class="line"><a name="l00878"></a><span class="lineno">  878</span>&#160;<span class="keyword">template</span> &lt;<span class="keyword">typename</span> T&gt; <span class="keyword">inline</span> <a class="code" href="group__math.html#ga4c88e729af0eb9bdaeab6845bb685874" title="Typedef for a 2-vector of floats.">Float3</a> operator+=(Vector3&lt;T&gt; &amp;u, <span class="keywordtype">float</span> k) { <span class="keywordflow">return</span> vec&lt;float&gt;(u.x+=k, u.y+=k, u.z+=k); }</div>
<div class="line"><a name="l00879"></a><span class="lineno">  879</span>&#160;<span class="keyword">template</span> &lt;<span class="keyword">typename</span> T&gt; <span class="keyword">inline</span> <a class="code" href="group__math.html#ga4c88e729af0eb9bdaeab6845bb685874" title="Typedef for a 2-vector of floats.">Float3</a> operator*=(Vector3&lt;T&gt; &amp;u, <span class="keywordtype">float</span> k) { <span class="keywordflow">return</span> vec&lt;float&gt;(u.x*=k, u.y*=k, u.z*=k); }</div>
<div class="line"><a name="l00880"></a><span class="lineno">  880</span>&#160;</div>
<div class="line"><a name="l00881"></a><span class="lineno">  881</span>&#160;<span class="comment">// Scalar double promotion</span></div>
<div class="line"><a name="l00882"></a><span class="lineno">  882</span>&#160;<span class="keyword">template</span> &lt;<span class="keyword">typename</span> T&gt; <span class="keyword">inline</span> <a class="code" href="group__math.html#ga27a00f39e0d622233fe4eb671d38fa28" title="Typedef for a 2-vector of double-precision floats.">Double3</a> operator*(<span class="keywordtype">double</span> k, Vector3&lt;T&gt; v) { <span class="keywordflow">return</span> vec&lt;double&gt;(k*v.x, k*v.y, k*v.z); }</div>
<div class="line"><a name="l00883"></a><span class="lineno">  883</span>&#160;<span class="keyword">template</span> &lt;<span class="keyword">typename</span> T&gt; <span class="keyword">inline</span> <a class="code" href="group__math.html#ga27a00f39e0d622233fe4eb671d38fa28" title="Typedef for a 2-vector of double-precision floats.">Double3</a> operator*(Vector3&lt;T&gt; v, <span class="keywordtype">double</span> k) { <span class="keywordflow">return</span> vec&lt;double&gt;(k*v.x, k*v.y, k*v.z); }</div>
<div class="line"><a name="l00884"></a><span class="lineno">  884</span>&#160;<span class="keyword">template</span> &lt;<span class="keyword">typename</span> T&gt; <span class="keyword">inline</span> <a class="code" href="group__math.html#ga27a00f39e0d622233fe4eb671d38fa28" title="Typedef for a 2-vector of double-precision floats.">Double3</a> operator/(Vector3&lt;T&gt; v, <span class="keywordtype">double</span> k) { <span class="keywordflow">return</span> vec&lt;double&gt;(v.x/k, v.y/k, v.z/k); }</div>
<div class="line"><a name="l00885"></a><span class="lineno">  885</span>&#160;<span class="keyword">template</span> &lt;<span class="keyword">typename</span> T&gt; <span class="keyword">inline</span> <a class="code" href="group__math.html#ga27a00f39e0d622233fe4eb671d38fa28" title="Typedef for a 2-vector of double-precision floats.">Double3</a> operator+=(Vector3&lt;T&gt; &amp;u, <span class="keywordtype">double</span> k) { <span class="keywordflow">return</span> vec&lt;double&gt;(u.x+=k, u.y+=k, u.z+=k); }</div>
<div class="line"><a name="l00886"></a><span class="lineno">  886</span>&#160;<span class="keyword">template</span> &lt;<span class="keyword">typename</span> T&gt; <span class="keyword">inline</span> <a class="code" href="group__math.html#ga27a00f39e0d622233fe4eb671d38fa28" title="Typedef for a 2-vector of double-precision floats.">Double3</a> operator*=(Vector3&lt;T&gt; &amp;u, <span class="keywordtype">double</span> k) { <span class="keywordflow">return</span> vec&lt;double&gt;(u.x*=k, u.y*=k, u.z*=k); }</div>
<div class="line"><a name="l00887"></a><span class="lineno">  887</span>&#160;</div>
<div class="line"><a name="l00888"></a><span class="lineno">  888</span>&#160;<span class="comment">// Vector int -&gt; float promotion</span></div>
<div class="line"><a name="l00889"></a><span class="lineno">  889</span>&#160;<span class="keyword">inline</span> <a class="code" href="group__math.html#ga4c88e729af0eb9bdaeab6845bb685874" title="Typedef for a 2-vector of floats.">Float3</a> operator+=(<a class="code" href="group__math.html#ga4c88e729af0eb9bdaeab6845bb685874" title="Typedef for a 2-vector of floats.">Float3</a> &amp;u, <a class="code" href="group__math.html#gadf60fc5d5c0643721fc47d903088be0e" title="Typedef for a 2-vector of ints.">Int3</a> v) { <span class="keywordflow">return</span> <a class="code" href="group__math.html#gab18c9af04a4a3a4a3c63656e40ab74ed" title="Create a Vector2, from a set of (x,y) coordinates.">vec</a>(u.x+=v.x, u.y+=v.y, u.z+=v.z); }</div>
<div class="line"><a name="l00890"></a><span class="lineno">  890</span>&#160;<span class="keyword">inline</span> <a class="code" href="group__math.html#ga4c88e729af0eb9bdaeab6845bb685874" title="Typedef for a 2-vector of floats.">Float3</a> operator-=(<a class="code" href="group__math.html#ga4c88e729af0eb9bdaeab6845bb685874" title="Typedef for a 2-vector of floats.">Float3</a> &amp;u, <a class="code" href="group__math.html#gadf60fc5d5c0643721fc47d903088be0e" title="Typedef for a 2-vector of ints.">Int3</a> v) { <span class="keywordflow">return</span> <a class="code" href="group__math.html#gab18c9af04a4a3a4a3c63656e40ab74ed" title="Create a Vector2, from a set of (x,y) coordinates.">vec</a>(u.x-=v.x, u.y-=v.y, u.z-=v.z); }</div>
<div class="line"><a name="l00891"></a><span class="lineno">  891</span>&#160;<span class="keyword">inline</span> <a class="code" href="group__math.html#ga4c88e729af0eb9bdaeab6845bb685874" title="Typedef for a 2-vector of floats.">Float3</a> operator+(<a class="code" href="group__math.html#ga4c88e729af0eb9bdaeab6845bb685874" title="Typedef for a 2-vector of floats.">Float3</a> u, <a class="code" href="group__math.html#gadf60fc5d5c0643721fc47d903088be0e" title="Typedef for a 2-vector of ints.">Int3</a> v) { <span class="keywordflow">return</span> <a class="code" href="group__math.html#gab18c9af04a4a3a4a3c63656e40ab74ed" title="Create a Vector2, from a set of (x,y) coordinates.">vec</a>(u.x+v.x, u.y+v.y, u.z+v.z); }</div>
<div class="line"><a name="l00892"></a><span class="lineno">  892</span>&#160;<span class="keyword">inline</span> <a class="code" href="group__math.html#ga4c88e729af0eb9bdaeab6845bb685874" title="Typedef for a 2-vector of floats.">Float3</a> operator-(<a class="code" href="group__math.html#ga4c88e729af0eb9bdaeab6845bb685874" title="Typedef for a 2-vector of floats.">Float3</a> u, <a class="code" href="group__math.html#gadf60fc5d5c0643721fc47d903088be0e" title="Typedef for a 2-vector of ints.">Int3</a> v) { <span class="keywordflow">return</span> <a class="code" href="group__math.html#gab18c9af04a4a3a4a3c63656e40ab74ed" title="Create a Vector2, from a set of (x,y) coordinates.">vec</a>(u.x-v.x, u.y-v.y, u.z-v.z); }</div>
<div class="line"><a name="l00893"></a><span class="lineno">  893</span>&#160;<span class="keyword">inline</span> <a class="code" href="group__math.html#ga4c88e729af0eb9bdaeab6845bb685874" title="Typedef for a 2-vector of floats.">Float3</a> operator*(<a class="code" href="group__math.html#ga4c88e729af0eb9bdaeab6845bb685874" title="Typedef for a 2-vector of floats.">Float3</a> u, <a class="code" href="group__math.html#gadf60fc5d5c0643721fc47d903088be0e" title="Typedef for a 2-vector of ints.">Int3</a> v) { <span class="keywordflow">return</span> <a class="code" href="group__math.html#gab18c9af04a4a3a4a3c63656e40ab74ed" title="Create a Vector2, from a set of (x,y) coordinates.">vec</a>(u.x*v.x, u.y*v.y, u.z*v.z); }</div>
<div class="line"><a name="l00894"></a><span class="lineno">  894</span>&#160;<span class="keyword">inline</span> <a class="code" href="group__math.html#ga4c88e729af0eb9bdaeab6845bb685874" title="Typedef for a 2-vector of floats.">Float3</a> operator+(<a class="code" href="group__math.html#gadf60fc5d5c0643721fc47d903088be0e" title="Typedef for a 2-vector of ints.">Int3</a> u, <a class="code" href="group__math.html#ga4c88e729af0eb9bdaeab6845bb685874" title="Typedef for a 2-vector of floats.">Float3</a> v) { <span class="keywordflow">return</span> <a class="code" href="group__math.html#gab18c9af04a4a3a4a3c63656e40ab74ed" title="Create a Vector2, from a set of (x,y) coordinates.">vec</a>(u.x+v.x, u.y+v.y, u.z+v.z); }</div>
<div class="line"><a name="l00895"></a><span class="lineno">  895</span>&#160;<span class="keyword">inline</span> <a class="code" href="group__math.html#ga4c88e729af0eb9bdaeab6845bb685874" title="Typedef for a 2-vector of floats.">Float3</a> operator-(<a class="code" href="group__math.html#gadf60fc5d5c0643721fc47d903088be0e" title="Typedef for a 2-vector of ints.">Int3</a> u, <a class="code" href="group__math.html#ga4c88e729af0eb9bdaeab6845bb685874" title="Typedef for a 2-vector of floats.">Float3</a> v) { <span class="keywordflow">return</span> <a class="code" href="group__math.html#gab18c9af04a4a3a4a3c63656e40ab74ed" title="Create a Vector2, from a set of (x,y) coordinates.">vec</a>(u.x-v.x, u.y-v.y, u.z-v.z); }</div>
<div class="line"><a name="l00896"></a><span class="lineno">  896</span>&#160;<span class="keyword">inline</span> <a class="code" href="group__math.html#ga4c88e729af0eb9bdaeab6845bb685874" title="Typedef for a 2-vector of floats.">Float3</a> operator*(<a class="code" href="group__math.html#gadf60fc5d5c0643721fc47d903088be0e" title="Typedef for a 2-vector of ints.">Int3</a> u, <a class="code" href="group__math.html#ga4c88e729af0eb9bdaeab6845bb685874" title="Typedef for a 2-vector of floats.">Float3</a> v) { <span class="keywordflow">return</span> <a class="code" href="group__math.html#gab18c9af04a4a3a4a3c63656e40ab74ed" title="Create a Vector2, from a set of (x,y) coordinates.">vec</a>(u.x*v.x, u.y*v.y, u.z*v.z); }</div>
<div class="line"><a name="l00897"></a><span class="lineno">  897</span>&#160;</div>
<div class="line"><a name="l00898"></a><span class="lineno">  898</span>&#160;</div>
<div class="line"><a name="l00908"></a><span class="lineno"><a class="code" href="struct_sifteo_1_1_random.html">  908</a></span>&#160;<span class="keyword">struct </span><a class="code" href="struct_sifteo_1_1_random.html" title="Pseudo-random number generator.">Random</a> {</div>
<div class="line"><a name="l00909"></a><span class="lineno">  909</span>&#160;    _SYSPseudoRandomState state;</div>
<div class="line"><a name="l00910"></a><span class="lineno">  910</span>&#160;</div>
<div class="line"><a name="l00912"></a><span class="lineno"><a class="code" href="struct_sifteo_1_1_random.html#a3ff0ae4aea430fa1856f2c10b6f85020">  912</a></span>&#160;    <a class="code" href="struct_sifteo_1_1_random.html#a3ff0ae4aea430fa1856f2c10b6f85020" title="Construct a new random number generator, using an arbitrary seed.">Random</a>() {</div>
<div class="line"><a name="l00913"></a><span class="lineno">  913</span>&#160;        <a class="code" href="struct_sifteo_1_1_random.html#a9c725f02e64dff344afc1bb4b0bdd1c4" title="Re-seed this random number generator arbitrarily.">seed</a>();</div>
<div class="line"><a name="l00914"></a><span class="lineno">  914</span>&#160;    }</div>
<div class="line"><a name="l00915"></a><span class="lineno">  915</span>&#160;    </div>
<div class="line"><a name="l00917"></a><span class="lineno"><a class="code" href="struct_sifteo_1_1_random.html#acaaa4c3327679e28f65b5a84faa5276a">  917</a></span>&#160;    <a class="code" href="struct_sifteo_1_1_random.html#acaaa4c3327679e28f65b5a84faa5276a" title="Construct a new random number generator with a well-defined seed.">Random</a>(uint32_t s) {</div>
<div class="line"><a name="l00918"></a><span class="lineno">  918</span>&#160;        <a class="code" href="struct_sifteo_1_1_random.html#a9c725f02e64dff344afc1bb4b0bdd1c4" title="Re-seed this random number generator arbitrarily.">seed</a>(s);</div>
<div class="line"><a name="l00919"></a><span class="lineno">  919</span>&#160;    }</div>
<div class="line"><a name="l00920"></a><span class="lineno">  920</span>&#160;    </div>
<div class="line"><a name="l00926"></a><span class="lineno"><a class="code" href="struct_sifteo_1_1_random.html#a1c837f44d0eb7d386897866c79a64570">  926</a></span>&#160;    <span class="keywordtype">void</span> <a class="code" href="struct_sifteo_1_1_random.html#a1c837f44d0eb7d386897866c79a64570" title="Re-seed this random number generator.">seed</a>(uint32_t s) {</div>
<div class="line"><a name="l00927"></a><span class="lineno">  927</span>&#160;        _SYS_prng_init(&amp;state, s);</div>
<div class="line"><a name="l00928"></a><span class="lineno">  928</span>&#160;    }</div>
<div class="line"><a name="l00929"></a><span class="lineno">  929</span>&#160;</div>
<div class="line"><a name="l00935"></a><span class="lineno"><a class="code" href="struct_sifteo_1_1_random.html#a9c725f02e64dff344afc1bb4b0bdd1c4">  935</a></span>&#160;    <span class="keywordtype">void</span> <a class="code" href="struct_sifteo_1_1_random.html#a9c725f02e64dff344afc1bb4b0bdd1c4" title="Re-seed this random number generator arbitrarily.">seed</a>() {</div>
<div class="line"><a name="l00936"></a><span class="lineno">  936</span>&#160;        <a class="code" href="struct_sifteo_1_1_random.html#a9c725f02e64dff344afc1bb4b0bdd1c4" title="Re-seed this random number generator arbitrarily.">seed</a>((uint32_t) _SYS_ticks_ns());</div>
<div class="line"><a name="l00937"></a><span class="lineno">  937</span>&#160;    }</div>
<div class="line"><a name="l00938"></a><span class="lineno">  938</span>&#160;</div>
<div class="line"><a name="l00940"></a><span class="lineno"><a class="code" href="struct_sifteo_1_1_random.html#a6add2fe2f365e20b0159291b6d4641f7">  940</a></span>&#160;    uint32_t <a class="code" href="struct_sifteo_1_1_random.html#a6add2fe2f365e20b0159291b6d4641f7" title="Returns the next raw 32-bit pseudo-random number.">raw</a>() {</div>
<div class="line"><a name="l00941"></a><span class="lineno">  941</span>&#160;        <span class="keywordflow">return</span> _SYS_prng_value(&amp;state);</div>
<div class="line"><a name="l00942"></a><span class="lineno">  942</span>&#160;    }</div>
<div class="line"><a name="l00943"></a><span class="lineno">  943</span>&#160;    </div>
<div class="line"><a name="l00945"></a><span class="lineno"><a class="code" href="struct_sifteo_1_1_random.html#a3c11f56b8d0a2446823cd1d19128f0fd">  945</a></span>&#160;    <span class="keywordtype">float</span> <a class="code" href="struct_sifteo_1_1_random.html#a3c11f56b8d0a2446823cd1d19128f0fd" title="Returns a uniformly distributed floating point number between 0 and 1, inclusive.">random</a>() {</div>
<div class="line"><a name="l00946"></a><span class="lineno">  946</span>&#160;        <span class="keywordflow">return</span> <a class="code" href="struct_sifteo_1_1_random.html#a6add2fe2f365e20b0159291b6d4641f7" title="Returns the next raw 32-bit pseudo-random number.">raw</a>() * (1.0f / 0xFFFFFFFF);</div>
<div class="line"><a name="l00947"></a><span class="lineno">  947</span>&#160;    }</div>
<div class="line"><a name="l00948"></a><span class="lineno">  948</span>&#160;    </div>
<div class="line"><a name="l00950"></a><span class="lineno"><a class="code" href="struct_sifteo_1_1_random.html#af899b186b31ab887e47710e10fcc7ec4">  950</a></span>&#160;    <span class="keywordtype">float</span> <a class="code" href="struct_sifteo_1_1_random.html#af899b186b31ab887e47710e10fcc7ec4" title="Returns a generated pseudorandom inverval for a poisson process (e.g. whack-a-mole timing)...">expovariate</a>(<span class="keywordtype">float</span> averageInterval) {</div>
<div class="line"><a name="l00951"></a><span class="lineno">  951</span>&#160;        <span class="keywordflow">return</span> -averageInterval * <a class="code" href="group__math.html#ga4c75549406b0cd0f1c3751641740f668" title="Compute the natural log of a floating point number. Single-precision.">log</a>(1.0f - <a class="code" href="struct_sifteo_1_1_random.html#a3c11f56b8d0a2446823cd1d19128f0fd" title="Returns a uniformly distributed floating point number between 0 and 1, inclusive.">random</a>());</div>
<div class="line"><a name="l00952"></a><span class="lineno">  952</span>&#160;    }</div>
<div class="line"><a name="l00953"></a><span class="lineno">  953</span>&#160;    </div>
<div class="line"><a name="l00962"></a><span class="lineno"><a class="code" href="struct_sifteo_1_1_random.html#a8c20f367d7149068f21f9713286a03f7">  962</a></span>&#160;    <span class="keywordtype">bool</span> <a class="code" href="struct_sifteo_1_1_random.html#a8c20f367d7149068f21f9713286a03f7" title="Take a chance. Returns a boolean that has a &#39;probability&#39; chance of being &#39;true&#39;.">chance</a>(<span class="keywordtype">float</span> probability) {</div>
<div class="line"><a name="l00963"></a><span class="lineno">  963</span>&#160;        <span class="comment">// Use 31 bits, to give us range to represent probability=1.</span></div>
<div class="line"><a name="l00964"></a><span class="lineno">  964</span>&#160;        <span class="keyword">const</span> uint32_t mask = 0x7FFFFFFF;</div>
<div class="line"><a name="l00965"></a><span class="lineno">  965</span>&#160;        uint32_t threshold = probability * (mask + 1);</div>
<div class="line"><a name="l00966"></a><span class="lineno">  966</span>&#160;        <span class="keywordflow">return</span> (<a class="code" href="struct_sifteo_1_1_random.html#a6add2fe2f365e20b0159291b6d4641f7" title="Returns the next raw 32-bit pseudo-random number.">raw</a>() &amp; mask) &lt; threshold;</div>
<div class="line"><a name="l00967"></a><span class="lineno">  967</span>&#160;    }</div>
<div class="line"><a name="l00968"></a><span class="lineno">  968</span>&#160;</div>
<div class="line"><a name="l00973"></a><span class="lineno"><a class="code" href="struct_sifteo_1_1_random.html#a1af06331806ac52b38fb9c9a79c0271d">  973</a></span>&#160;    <span class="keywordtype">float</span> <a class="code" href="struct_sifteo_1_1_random.html#a1af06331806ac52b38fb9c9a79c0271d" title="Returns a uniformly distributed floating point number in the range [a, b) or [a, b], depending on rounding.">uniform</a>(<span class="keywordtype">float</span> a, <span class="keywordtype">float</span> b) {</div>
<div class="line"><a name="l00974"></a><span class="lineno">  974</span>&#160;        <span class="comment">// Order of operations here allows constant folding if the endpoints are constant</span></div>
<div class="line"><a name="l00975"></a><span class="lineno">  975</span>&#160;        <span class="keywordflow">return</span> a + <a class="code" href="struct_sifteo_1_1_random.html#a6add2fe2f365e20b0159291b6d4641f7" title="Returns the next raw 32-bit pseudo-random number.">raw</a>() * ((b-a) / 0xFFFFFFFF);</div>
<div class="line"><a name="l00976"></a><span class="lineno">  976</span>&#160;    }</div>
<div class="line"><a name="l00977"></a><span class="lineno">  977</span>&#160;</div>
<div class="line"><a name="l00982"></a><span class="lineno">  982</span>&#160;    <span class="keyword">template</span> &lt;<span class="keyword">typename</span> T&gt;</div>
<div class="line"><a name="l00983"></a><span class="lineno"><a class="code" href="struct_sifteo_1_1_random.html#a02940bde6f5e545ca65274304afcdc50">  983</a></span>&#160;    T <a class="code" href="struct_sifteo_1_1_random.html#a02940bde6f5e545ca65274304afcdc50" title="Returns a uniformly distributed random integer in the range [a, b], including both end points...">randint</a>(T a, T b) {</div>
<div class="line"><a name="l00984"></a><span class="lineno">  984</span>&#160;        <span class="keywordflow">return</span> T(a + _SYS_prng_valueBounded(&amp;state, b - a));</div>
<div class="line"><a name="l00985"></a><span class="lineno">  985</span>&#160;    }</div>
<div class="line"><a name="l00986"></a><span class="lineno">  986</span>&#160;</div>
<div class="line"><a name="l00991"></a><span class="lineno">  991</span>&#160;    <span class="keyword">template</span> &lt;<span class="keyword">typename</span> T&gt;</div>
<div class="line"><a name="l00992"></a><span class="lineno"><a class="code" href="struct_sifteo_1_1_random.html#a20c4d97a91204a952582866d6d504b62">  992</a></span>&#160;    T <a class="code" href="struct_sifteo_1_1_random.html#a20c4d97a91204a952582866d6d504b62" title="Returns a uniformly distributed random integer in the half-open interval [a, b), including the lower ...">randrange</a>(T a, T b) {</div>
<div class="line"><a name="l00993"></a><span class="lineno">  993</span>&#160;        <span class="keywordflow">return</span> randint&lt;T&gt;(a, T(b - 1));</div>
<div class="line"><a name="l00994"></a><span class="lineno">  994</span>&#160;    }</div>
<div class="line"><a name="l00995"></a><span class="lineno">  995</span>&#160;</div>
<div class="line"><a name="l01002"></a><span class="lineno"> 1002</span>&#160;    <span class="keyword">template</span> &lt;<span class="keyword">typename</span> T&gt;</div>
<div class="line"><a name="l01003"></a><span class="lineno"><a class="code" href="struct_sifteo_1_1_random.html#a47468c63e0617b037389be633d897178"> 1003</a></span>&#160;    T <a class="code" href="struct_sifteo_1_1_random.html#a47468c63e0617b037389be633d897178" title="The one-argument variant of randrange() always starts at zero, and returns an integer up to but not i...">randrange</a>(T count) {</div>
<div class="line"><a name="l01004"></a><span class="lineno"> 1004</span>&#160;        <span class="keywordflow">return</span> randrange&lt;T&gt;(T(0), count);</div>
<div class="line"><a name="l01005"></a><span class="lineno"> 1005</span>&#160;    }</div>
<div class="line"><a name="l01006"></a><span class="lineno"> 1006</span>&#160;</div>
<div class="line"><a name="l01007"></a><span class="lineno"> 1007</span>&#160;};</div>
<div class="line"><a name="l01008"></a><span class="lineno"> 1008</span>&#160;</div>
<div class="line"><a name="l01009"></a><span class="lineno"> 1009</span>&#160;</div>
<div class="line"><a name="l01023"></a><span class="lineno"><a class="code" href="struct_sifteo_1_1_affine_matrix.html"> 1023</a></span>&#160;<span class="keyword">struct </span><a class="code" href="struct_sifteo_1_1_affine_matrix.html" title="An augmented 3x2 matrix, for doing 2D affine transforms.">AffineMatrix</a> {</div>
<div class="line"><a name="l01024"></a><span class="lineno"><a class="code" href="struct_sifteo_1_1_affine_matrix.html#a1159378a07ac177ee26ba7460e77efc8"> 1024</a></span>&#160;    <span class="keywordtype">float</span> <a class="code" href="struct_sifteo_1_1_affine_matrix.html#a1159378a07ac177ee26ba7460e77efc8" title="Matrix member cx, the constant offset for X.">cx</a>;   </div>
<div class="line"><a name="l01025"></a><span class="lineno"><a class="code" href="struct_sifteo_1_1_affine_matrix.html#a633cc1c8eb9d03698e395230ee3b5ef4"> 1025</a></span>&#160;    <span class="keywordtype">float</span> <a class="code" href="struct_sifteo_1_1_affine_matrix.html#a633cc1c8eb9d03698e395230ee3b5ef4" title="Matrix member cy, the constant offset for Y.">cy</a>;   </div>
<div class="line"><a name="l01026"></a><span class="lineno"><a class="code" href="struct_sifteo_1_1_affine_matrix.html#ac26e83ff5e2698516813b3032c8b9795"> 1026</a></span>&#160;    <span class="keywordtype">float</span> <a class="code" href="struct_sifteo_1_1_affine_matrix.html#ac26e83ff5e2698516813b3032c8b9795" title="Matrix member xx, the horizontal X delta.">xx</a>;   </div>
<div class="line"><a name="l01027"></a><span class="lineno"><a class="code" href="struct_sifteo_1_1_affine_matrix.html#a9b3fcff7820d2ab5d160f74204723e65"> 1027</a></span>&#160;    <span class="keywordtype">float</span> <a class="code" href="struct_sifteo_1_1_affine_matrix.html#a9b3fcff7820d2ab5d160f74204723e65" title="Matrix member xy, the horizontal Y delta.">xy</a>;   </div>
<div class="line"><a name="l01028"></a><span class="lineno"><a class="code" href="struct_sifteo_1_1_affine_matrix.html#ada7a312253d20f2dfc734d6a6b8a0428"> 1028</a></span>&#160;    <span class="keywordtype">float</span> <a class="code" href="struct_sifteo_1_1_affine_matrix.html#ada7a312253d20f2dfc734d6a6b8a0428" title="Matrix member yx, the vertical X delta.">yx</a>;   </div>
<div class="line"><a name="l01029"></a><span class="lineno"><a class="code" href="struct_sifteo_1_1_affine_matrix.html#aa32dde48158e502f49be4956cd67f43b"> 1029</a></span>&#160;    <span class="keywordtype">float</span> <a class="code" href="struct_sifteo_1_1_affine_matrix.html#aa32dde48158e502f49be4956cd67f43b" title="Matrix member yy, the vertical Y delta.">yy</a>;   </div>
<div class="line"><a name="l01030"></a><span class="lineno"> 1030</span>&#160;</div>
<div class="line"><a name="l01032"></a><span class="lineno"><a class="code" href="struct_sifteo_1_1_affine_matrix.html#aebf43759013b88f76375433e977d3306"> 1032</a></span>&#160;    <a class="code" href="struct_sifteo_1_1_affine_matrix.html#aebf43759013b88f76375433e977d3306" title="Create an uninitialized matrix.">AffineMatrix</a>() {}</div>
<div class="line"><a name="l01033"></a><span class="lineno"> 1033</span>&#160;</div>
<div class="line"><a name="l01035"></a><span class="lineno"><a class="code" href="struct_sifteo_1_1_affine_matrix.html#a0fab8532bd91c8edc8824b027254f0e2"> 1035</a></span>&#160;    <a class="code" href="struct_sifteo_1_1_affine_matrix.html#aebf43759013b88f76375433e977d3306" title="Create an uninitialized matrix.">AffineMatrix</a>(<span class="keywordtype">float</span> _xx, <span class="keywordtype">float</span> _yx, <span class="keywordtype">float</span> _cx,</div>
<div class="line"><a name="l01036"></a><span class="lineno"> 1036</span>&#160;                 <span class="keywordtype">float</span> _xy, <span class="keywordtype">float</span> _yy, <span class="keywordtype">float</span> _cy)</div>
<div class="line"><a name="l01037"></a><span class="lineno"> 1037</span>&#160;        : <a class="code" href="struct_sifteo_1_1_affine_matrix.html#a1159378a07ac177ee26ba7460e77efc8" title="Matrix member cx, the constant offset for X.">cx</a>(_cx), <a class="code" href="struct_sifteo_1_1_affine_matrix.html#a633cc1c8eb9d03698e395230ee3b5ef4" title="Matrix member cy, the constant offset for Y.">cy</a>(_cy), <a class="code" href="struct_sifteo_1_1_affine_matrix.html#ac26e83ff5e2698516813b3032c8b9795" title="Matrix member xx, the horizontal X delta.">xx</a>(_xx),</div>
<div class="line"><a name="l01038"></a><span class="lineno"> 1038</span>&#160;          <a class="code" href="struct_sifteo_1_1_affine_matrix.html#a9b3fcff7820d2ab5d160f74204723e65" title="Matrix member xy, the horizontal Y delta.">xy</a>(_xy), <a class="code" href="struct_sifteo_1_1_affine_matrix.html#ada7a312253d20f2dfc734d6a6b8a0428" title="Matrix member yx, the vertical X delta.">yx</a>(_yx), <a class="code" href="struct_sifteo_1_1_affine_matrix.html#aa32dde48158e502f49be4956cd67f43b" title="Matrix member yy, the vertical Y delta.">yy</a>(_yy) {}</div>
<div class="line"><a name="l01039"></a><span class="lineno"> 1039</span>&#160;    </div>
<div class="line"><a name="l01041"></a><span class="lineno"><a class="code" href="struct_sifteo_1_1_affine_matrix.html#a5d02c1b0d8b57b18cbd11dd8040bd2d5"> 1041</a></span>&#160;    <span class="keyword">static</span> <a class="code" href="struct_sifteo_1_1_affine_matrix.html" title="An augmented 3x2 matrix, for doing 2D affine transforms.">AffineMatrix</a> <a class="code" href="struct_sifteo_1_1_affine_matrix.html#a5d02c1b0d8b57b18cbd11dd8040bd2d5" title="Create the identity matrix.">identity</a>() {</div>
<div class="line"><a name="l01042"></a><span class="lineno"> 1042</span>&#160;        <span class="keywordflow">return</span> <a class="code" href="struct_sifteo_1_1_affine_matrix.html#aebf43759013b88f76375433e977d3306" title="Create an uninitialized matrix.">AffineMatrix</a>(1, 0, 0,</div>
<div class="line"><a name="l01043"></a><span class="lineno"> 1043</span>&#160;                            0, 1, 0);</div>
<div class="line"><a name="l01044"></a><span class="lineno"> 1044</span>&#160;    }</div>
<div class="line"><a name="l01045"></a><span class="lineno"> 1045</span>&#160;</div>
<div class="line"><a name="l01047"></a><span class="lineno"><a class="code" href="struct_sifteo_1_1_affine_matrix.html#a635753a6897eea73ef7f02aecc84da56"> 1047</a></span>&#160;    <span class="keyword">static</span> <a class="code" href="struct_sifteo_1_1_affine_matrix.html" title="An augmented 3x2 matrix, for doing 2D affine transforms.">AffineMatrix</a> <a class="code" href="struct_sifteo_1_1_affine_matrix.html#a635753a6897eea73ef7f02aecc84da56" title="Create a matrix which scales by a factor of &#39;s&#39;.">scaling</a>(<span class="keywordtype">float</span> s) {</div>
<div class="line"><a name="l01048"></a><span class="lineno"> 1048</span>&#160;        <span class="keywordtype">float</span> inv_s = 1.0f / s;</div>
<div class="line"><a name="l01049"></a><span class="lineno"> 1049</span>&#160;        <span class="keywordflow">return</span> <a class="code" href="struct_sifteo_1_1_affine_matrix.html#aebf43759013b88f76375433e977d3306" title="Create an uninitialized matrix.">AffineMatrix</a>(inv_s, 0, 0,</div>
<div class="line"><a name="l01050"></a><span class="lineno"> 1050</span>&#160;                            0, inv_s, 0);</div>
<div class="line"><a name="l01051"></a><span class="lineno"> 1051</span>&#160;    }</div>
<div class="line"><a name="l01052"></a><span class="lineno"> 1052</span>&#160;</div>
<div class="line"><a name="l01054"></a><span class="lineno"><a class="code" href="struct_sifteo_1_1_affine_matrix.html#a628e4847a021a4503c803db1b828d64c"> 1054</a></span>&#160;    <span class="keyword">static</span> <a class="code" href="struct_sifteo_1_1_affine_matrix.html" title="An augmented 3x2 matrix, for doing 2D affine transforms.">AffineMatrix</a> <a class="code" href="struct_sifteo_1_1_affine_matrix.html#a628e4847a021a4503c803db1b828d64c" title="Create a matrix which translates by (x, y)">translation</a>(<span class="keywordtype">float</span> x, <span class="keywordtype">float</span> y) {</div>
<div class="line"><a name="l01055"></a><span class="lineno"> 1055</span>&#160;        <span class="keywordflow">return</span> <a class="code" href="struct_sifteo_1_1_affine_matrix.html#aebf43759013b88f76375433e977d3306" title="Create an uninitialized matrix.">AffineMatrix</a>(1, 0, x,</div>
<div class="line"><a name="l01056"></a><span class="lineno"> 1056</span>&#160;                            0, 1, y);</div>
<div class="line"><a name="l01057"></a><span class="lineno"> 1057</span>&#160;    }</div>
<div class="line"><a name="l01058"></a><span class="lineno"> 1058</span>&#160;</div>
<div class="line"><a name="l01060"></a><span class="lineno"><a class="code" href="struct_sifteo_1_1_affine_matrix.html#a2ac9fd8e39295eee06566fd45555f361"> 1060</a></span>&#160;    <span class="keyword">static</span> <a class="code" href="struct_sifteo_1_1_affine_matrix.html" title="An augmented 3x2 matrix, for doing 2D affine transforms.">AffineMatrix</a> <a class="code" href="struct_sifteo_1_1_affine_matrix.html#a2ac9fd8e39295eee06566fd45555f361" title="Create a matrix which translates by vector &#39;v&#39;.">translation</a>(<a class="code" href="struct_sifteo_1_1_vector2.html">Float2</a> v) {</div>
<div class="line"><a name="l01061"></a><span class="lineno"> 1061</span>&#160;        <span class="keywordflow">return</span> <a class="code" href="struct_sifteo_1_1_affine_matrix.html#aebf43759013b88f76375433e977d3306" title="Create an uninitialized matrix.">AffineMatrix</a>(1, 0, v.<a class="code" href="struct_sifteo_1_1_vector2.html#a7362956454caca88012382934a1e94b9" title="Vector component X.">x</a>,</div>
<div class="line"><a name="l01062"></a><span class="lineno"> 1062</span>&#160;                            0, 1, v.<a class="code" href="struct_sifteo_1_1_vector2.html#a6ef946409dc8f1fb0fb21f158ad12bec" title="Vector component Y.">y</a>);</div>
<div class="line"><a name="l01063"></a><span class="lineno"> 1063</span>&#160;    }</div>
<div class="line"><a name="l01064"></a><span class="lineno"> 1064</span>&#160;</div>
<div class="line"><a name="l01066"></a><span class="lineno"><a class="code" href="struct_sifteo_1_1_affine_matrix.html#aa71c9d3e051ec0d088747352bc104a4e"> 1066</a></span>&#160;    <span class="keyword">static</span> <a class="code" href="struct_sifteo_1_1_affine_matrix.html" title="An augmented 3x2 matrix, for doing 2D affine transforms.">AffineMatrix</a> <a class="code" href="struct_sifteo_1_1_affine_matrix.html#aa71c9d3e051ec0d088747352bc104a4e" title="Create a matrix which rotates by &#39;angle&#39; radians.">rotation</a>(<span class="keywordtype">float</span> angle) {</div>
<div class="line"><a name="l01067"></a><span class="lineno"> 1067</span>&#160;        <span class="keywordtype">float</span> s, c;</div>
<div class="line"><a name="l01068"></a><span class="lineno"> 1068</span>&#160;        <a class="code" href="group__math.html#ga638c110b2937214ee62cbc7ddabad130" title="Simultaneously compute the sine and cosine of a specified angle, in radians.">sincos</a>(angle, &amp;s, &amp;c);</div>
<div class="line"><a name="l01069"></a><span class="lineno"> 1069</span>&#160;        <span class="keywordflow">return</span> <a class="code" href="struct_sifteo_1_1_affine_matrix.html#aebf43759013b88f76375433e977d3306" title="Create an uninitialized matrix.">AffineMatrix</a>(c, -s, 0,</div>
<div class="line"><a name="l01070"></a><span class="lineno"> 1070</span>&#160;                            s, c, 0);</div>
<div class="line"><a name="l01071"></a><span class="lineno"> 1071</span>&#160;    }</div>
<div class="line"><a name="l01072"></a><span class="lineno"> 1072</span>&#160;</div>
<div class="line"><a name="l01074"></a><span class="lineno"><a class="code" href="struct_sifteo_1_1_affine_matrix.html#af2aec3f033f6eb7d0c8c60b7460108fc"> 1074</a></span>&#160;    <span class="keywordtype">void</span> <a class="code" href="struct_sifteo_1_1_affine_matrix.html#af2aec3f033f6eb7d0c8c60b7460108fc" title="Matrix multiplication.">operator*= </a>(<span class="keyword">const</span> <a class="code" href="struct_sifteo_1_1_affine_matrix.html" title="An augmented 3x2 matrix, for doing 2D affine transforms.">AffineMatrix</a> &amp;m) {</div>
<div class="line"><a name="l01075"></a><span class="lineno"> 1075</span>&#160;        <a class="code" href="struct_sifteo_1_1_affine_matrix.html" title="An augmented 3x2 matrix, for doing 2D affine transforms.">AffineMatrix</a> n;</div>
<div class="line"><a name="l01076"></a><span class="lineno"> 1076</span>&#160;</div>
<div class="line"><a name="l01077"></a><span class="lineno"> 1077</span>&#160;        n.<a class="code" href="struct_sifteo_1_1_affine_matrix.html#a1159378a07ac177ee26ba7460e77efc8" title="Matrix member cx, the constant offset for X.">cx</a> = <a class="code" href="struct_sifteo_1_1_affine_matrix.html#ac26e83ff5e2698516813b3032c8b9795" title="Matrix member xx, the horizontal X delta.">xx</a>*m.<a class="code" href="struct_sifteo_1_1_affine_matrix.html#a1159378a07ac177ee26ba7460e77efc8" title="Matrix member cx, the constant offset for X.">cx</a> + <a class="code" href="struct_sifteo_1_1_affine_matrix.html#ada7a312253d20f2dfc734d6a6b8a0428" title="Matrix member yx, the vertical X delta.">yx</a>*m.<a class="code" href="struct_sifteo_1_1_affine_matrix.html#a633cc1c8eb9d03698e395230ee3b5ef4" title="Matrix member cy, the constant offset for Y.">cy</a> + <a class="code" href="struct_sifteo_1_1_affine_matrix.html#a1159378a07ac177ee26ba7460e77efc8" title="Matrix member cx, the constant offset for X.">cx</a>;</div>
<div class="line"><a name="l01078"></a><span class="lineno"> 1078</span>&#160;        n.<a class="code" href="struct_sifteo_1_1_affine_matrix.html#a633cc1c8eb9d03698e395230ee3b5ef4" title="Matrix member cy, the constant offset for Y.">cy</a> = <a class="code" href="struct_sifteo_1_1_affine_matrix.html#a9b3fcff7820d2ab5d160f74204723e65" title="Matrix member xy, the horizontal Y delta.">xy</a>*m.<a class="code" href="struct_sifteo_1_1_affine_matrix.html#a1159378a07ac177ee26ba7460e77efc8" title="Matrix member cx, the constant offset for X.">cx</a> + <a class="code" href="struct_sifteo_1_1_affine_matrix.html#aa32dde48158e502f49be4956cd67f43b" title="Matrix member yy, the vertical Y delta.">yy</a>*m.<a class="code" href="struct_sifteo_1_1_affine_matrix.html#a633cc1c8eb9d03698e395230ee3b5ef4" title="Matrix member cy, the constant offset for Y.">cy</a> + <a class="code" href="struct_sifteo_1_1_affine_matrix.html#a633cc1c8eb9d03698e395230ee3b5ef4" title="Matrix member cy, the constant offset for Y.">cy</a>;</div>
<div class="line"><a name="l01079"></a><span class="lineno"> 1079</span>&#160;        n.<a class="code" href="struct_sifteo_1_1_affine_matrix.html#ac26e83ff5e2698516813b3032c8b9795" title="Matrix member xx, the horizontal X delta.">xx</a> = <a class="code" href="struct_sifteo_1_1_affine_matrix.html#ac26e83ff5e2698516813b3032c8b9795" title="Matrix member xx, the horizontal X delta.">xx</a>*m.<a class="code" href="struct_sifteo_1_1_affine_matrix.html#ac26e83ff5e2698516813b3032c8b9795" title="Matrix member xx, the horizontal X delta.">xx</a> + <a class="code" href="struct_sifteo_1_1_affine_matrix.html#ada7a312253d20f2dfc734d6a6b8a0428" title="Matrix member yx, the vertical X delta.">yx</a>*m.<a class="code" href="struct_sifteo_1_1_affine_matrix.html#a9b3fcff7820d2ab5d160f74204723e65" title="Matrix member xy, the horizontal Y delta.">xy</a>;</div>
<div class="line"><a name="l01080"></a><span class="lineno"> 1080</span>&#160;        n.<a class="code" href="struct_sifteo_1_1_affine_matrix.html#a9b3fcff7820d2ab5d160f74204723e65" title="Matrix member xy, the horizontal Y delta.">xy</a> = <a class="code" href="struct_sifteo_1_1_affine_matrix.html#a9b3fcff7820d2ab5d160f74204723e65" title="Matrix member xy, the horizontal Y delta.">xy</a>*m.<a class="code" href="struct_sifteo_1_1_affine_matrix.html#ac26e83ff5e2698516813b3032c8b9795" title="Matrix member xx, the horizontal X delta.">xx</a> + <a class="code" href="struct_sifteo_1_1_affine_matrix.html#aa32dde48158e502f49be4956cd67f43b" title="Matrix member yy, the vertical Y delta.">yy</a>*m.<a class="code" href="struct_sifteo_1_1_affine_matrix.html#a9b3fcff7820d2ab5d160f74204723e65" title="Matrix member xy, the horizontal Y delta.">xy</a>;</div>
<div class="line"><a name="l01081"></a><span class="lineno"> 1081</span>&#160;        n.<a class="code" href="struct_sifteo_1_1_affine_matrix.html#ada7a312253d20f2dfc734d6a6b8a0428" title="Matrix member yx, the vertical X delta.">yx</a> = <a class="code" href="struct_sifteo_1_1_affine_matrix.html#ac26e83ff5e2698516813b3032c8b9795" title="Matrix member xx, the horizontal X delta.">xx</a>*m.<a class="code" href="struct_sifteo_1_1_affine_matrix.html#ada7a312253d20f2dfc734d6a6b8a0428" title="Matrix member yx, the vertical X delta.">yx</a> + <a class="code" href="struct_sifteo_1_1_affine_matrix.html#ada7a312253d20f2dfc734d6a6b8a0428" title="Matrix member yx, the vertical X delta.">yx</a>*m.<a class="code" href="struct_sifteo_1_1_affine_matrix.html#aa32dde48158e502f49be4956cd67f43b" title="Matrix member yy, the vertical Y delta.">yy</a>;</div>
<div class="line"><a name="l01082"></a><span class="lineno"> 1082</span>&#160;        n.<a class="code" href="struct_sifteo_1_1_affine_matrix.html#aa32dde48158e502f49be4956cd67f43b" title="Matrix member yy, the vertical Y delta.">yy</a> = <a class="code" href="struct_sifteo_1_1_affine_matrix.html#a9b3fcff7820d2ab5d160f74204723e65" title="Matrix member xy, the horizontal Y delta.">xy</a>*m.<a class="code" href="struct_sifteo_1_1_affine_matrix.html#ada7a312253d20f2dfc734d6a6b8a0428" title="Matrix member yx, the vertical X delta.">yx</a> + <a class="code" href="struct_sifteo_1_1_affine_matrix.html#aa32dde48158e502f49be4956cd67f43b" title="Matrix member yy, the vertical Y delta.">yy</a>*m.<a class="code" href="struct_sifteo_1_1_affine_matrix.html#aa32dde48158e502f49be4956cd67f43b" title="Matrix member yy, the vertical Y delta.">yy</a>;</div>
<div class="line"><a name="l01083"></a><span class="lineno"> 1083</span>&#160;</div>
<div class="line"><a name="l01084"></a><span class="lineno"> 1084</span>&#160;        *<span class="keyword">this</span> = n;</div>
<div class="line"><a name="l01085"></a><span class="lineno"> 1085</span>&#160;    }</div>
<div class="line"><a name="l01086"></a><span class="lineno"> 1086</span>&#160;</div>
<div class="line"><a name="l01088"></a><span class="lineno"><a class="code" href="struct_sifteo_1_1_affine_matrix.html#a39b6a91f9aea7e909a99d237c09da0fd"> 1088</a></span>&#160;    <span class="keywordtype">void</span> <a class="code" href="struct_sifteo_1_1_affine_matrix.html#a39b6a91f9aea7e909a99d237c09da0fd" title="Compose this matrix with a translation by (x, y)">translate</a>(<span class="keywordtype">float</span> x, <span class="keywordtype">float</span> y) {</div>
<div class="line"><a name="l01089"></a><span class="lineno"> 1089</span>&#160;        *<span class="keyword">this</span> *= <a class="code" href="struct_sifteo_1_1_affine_matrix.html#a628e4847a021a4503c803db1b828d64c" title="Create a matrix which translates by (x, y)">translation</a>(x, y);</div>
<div class="line"><a name="l01090"></a><span class="lineno"> 1090</span>&#160;    }</div>
<div class="line"><a name="l01091"></a><span class="lineno"> 1091</span>&#160;</div>
<div class="line"><a name="l01093"></a><span class="lineno"><a class="code" href="struct_sifteo_1_1_affine_matrix.html#a44a91e82d3fd746d8adf9b447c3a2851"> 1093</a></span>&#160;    <span class="keywordtype">void</span> <a class="code" href="struct_sifteo_1_1_affine_matrix.html#a44a91e82d3fd746d8adf9b447c3a2851" title="Compose this matrix with a translation by vector &#39;v&#39;.">translate</a>(<a class="code" href="struct_sifteo_1_1_vector2.html">Float2</a> v) {</div>
<div class="line"><a name="l01094"></a><span class="lineno"> 1094</span>&#160;        *<span class="keyword">this</span> *= <a class="code" href="struct_sifteo_1_1_affine_matrix.html#a628e4847a021a4503c803db1b828d64c" title="Create a matrix which translates by (x, y)">translation</a>(v);</div>
<div class="line"><a name="l01095"></a><span class="lineno"> 1095</span>&#160;    }</div>
<div class="line"><a name="l01096"></a><span class="lineno"> 1096</span>&#160;</div>
<div class="line"><a name="l01098"></a><span class="lineno"><a class="code" href="struct_sifteo_1_1_affine_matrix.html#ac0ed2edc61f2ba6823f64a7c3da58146"> 1098</a></span>&#160;    <span class="keywordtype">void</span> <a class="code" href="struct_sifteo_1_1_affine_matrix.html#ac0ed2edc61f2ba6823f64a7c3da58146" title="Compose this matrix with a rotation by &#39;angle&#39; radians.">rotate</a>(<span class="keywordtype">float</span> angle) {</div>
<div class="line"><a name="l01099"></a><span class="lineno"> 1099</span>&#160;        *<span class="keyword">this</span> *= <a class="code" href="struct_sifteo_1_1_affine_matrix.html#aa71c9d3e051ec0d088747352bc104a4e" title="Create a matrix which rotates by &#39;angle&#39; radians.">rotation</a>(angle);</div>
<div class="line"><a name="l01100"></a><span class="lineno"> 1100</span>&#160;    }</div>
<div class="line"><a name="l01101"></a><span class="lineno"> 1101</span>&#160;</div>
<div class="line"><a name="l01103"></a><span class="lineno"><a class="code" href="struct_sifteo_1_1_affine_matrix.html#af54d14b31203b446154d4e39d2a96376"> 1103</a></span>&#160;    <span class="keywordtype">void</span> <a class="code" href="struct_sifteo_1_1_affine_matrix.html#af54d14b31203b446154d4e39d2a96376" title="Compose this matrix with a scale by factor &#39;s&#39;.">scale</a>(<span class="keywordtype">float</span> s) {</div>
<div class="line"><a name="l01104"></a><span class="lineno"> 1104</span>&#160;        *<span class="keyword">this</span> *= <a class="code" href="struct_sifteo_1_1_affine_matrix.html#a635753a6897eea73ef7f02aecc84da56" title="Create a matrix which scales by a factor of &#39;s&#39;.">scaling</a>(s);</div>
<div class="line"><a name="l01105"></a><span class="lineno"> 1105</span>&#160;    }</div>
<div class="line"><a name="l01106"></a><span class="lineno"> 1106</span>&#160;};</div>
<div class="line"><a name="l01107"></a><span class="lineno"> 1107</span>&#160;</div>
<div class="line"><a name="l01112"></a><span class="lineno"> 1112</span>&#160;}   <span class="comment">// namespace Sifteo</span></div>
</div><!-- fragment --></div><!-- contents -->
<!-- HTML footer for doxygen 1.8.3.1-->
<!-- start footer part -->
    <hr class="footer"/>
    <address class="footer">
        <p><a href="http://sifteo.com">Sifteo</a> SDK v1.0.0 <small>(see <a href="https://developers.sifteo.com/sifteosdk">all versions</a>)</small></p>
        <p>Last updated Wed Mar 27 2013, by <a href="http://www.stack.nl/~dimitri/doxygen">Doxygen</a></p>
    </address>
</body>
</html>
